EAS ignoring local versionCode in build - android

I recently updated our Expo project from sdk 44 to 46.
During that process, I switched from Expo build:android to eas build -p android.
Everything is running as expected, except the version code is not compiled into the aab/apk files correctly, so I cant push updates to google play.
The version code is already set to 26, as we did release previous versions, and the semVer is 1.1.1 currently. EAS also doesn't show the correct version codes in the dashboard.
I tried setting "appVersionSource": "local" as well as "remote", but neither works. (As far as I understand, local should be the correct parameter.
eas build generally seems to ignore other parameters from the app.config.js, like the splash images, app icons and background colors (I didn't include those lines in the code examples below to keep it short)
eas.json
{
"cli": {
"version": ">= 2.3.0",
"appVersionSource": "local"
},
"build": {
...
"production": {
"channel": "production",
"env": {
"APP_ENV": "production"
},
"android": {
"buildType": "app-bundle",
"image": "latest"
}
}
},
"submit": {
"production": {}
}
}
app.config.js
import 'dotenv/config';
module.exports = {
expo: {
name: '...',
slug: '...',
version: '1.1.1',
assetBundlePatterns: ['**/*'],
android: {
package: '...',
versionCode: 26,
softwareKeyboardLayoutMode: 'pan',
},
extra: {
eas: {
projectId: '...',
},
releaseChannel: process.env.APP_ENV,
},
},
};
Eas showing the wrong version nr

Try running npx expo prebuild or npx expo run:android That would generate the native Android project, which is basically like the Bare workflow.
See the following post for some more details and what you can do:
https://forums.expo.dev/t/should-i-exclude-ios/63094/4
If this helped you I would really appreciate it if you mark this as the answer. Thanks :)

Related

EAS building got Strange

I build an apk using EAS to test my app with my android phone.
Strangely, when i used the expo build:android -t apk, my app was a little bit heavier (around 68 Mo) but it's work fine like when i test it on Expo Go App.
But, after using eas-cli with this command eas build -p android --profile preview, my apk file was pretty lighter (only 35 Mo), but it's i doesn't work now. It stucks at the main panel.
Perhaps i have an misunderstanding of the eas-cli. I'm reading hardly the doc right now but you're welcome if you have much more exp with eas-cli.
My eas.json file
{
"cli": {
"version": ">= 0.50.0"
},
"build": {
"preview": {
"ios": {
"simulator":true
},
"android":{
"buildApk":true
}
}
}
}

Proxy setting in Ionic version 4+ for Android

I am developing hybrid app for Android using Ionic 5 in local environment and so I tried to set up the proxy config as following below.
In command line
$ ionic config set proxy http://myserver.com
changed ionic.config.json file:
{
"name": "appName",
"integrations": {
"capacitor": {},
"cordova": {}
},
"type": "angular",
"proxy": "http://myserver.com"
}
But it didn't work and please help me with this issue.
Note:
I know already proxy configuration for Angular project as below, but it didn't work in Android app.
"options": {
"browserTarget": "app:build",
"proxyConfig": "proxy.conf.json"
}

React Expo changing target Android API

Recently we build Android Apps using react expo and build signed APK using bellow command expo build:android -t apk or Android App Bundle expo build:android -t app-bundle
After we build signed APK, we tried to upload to Playstore and some error appears that wanted us to upgrade target API from 26 to 28. Have explored and reading several QA at SO and many of them are intended for React Native. How we can publish our APK to Play Store?
Here are app.json
{
"expo": {
"name": "***",
"slug": "***",
"privacy": "public",
"sdkVersion": "32.0.0",
"platforms": [
"ios",
"android"
],
"version": "1.2.3",
"orientation": "portrait",
"icon": "./assets/logo.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"enabled": true,
"checkAutomatically": "ON_LOAD",
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"package": "com.qreatiq.foodmart",
"permissions": [
"CAMERA"
],
"googleServicesFile": "./google-services.json",
},
}
}
We've tried to check the documentation here and there are property for compileSDKVersion or related like native apps.
In Native app we can easily configure as bellow
compileSdkVersion 27
buildToolsVersion "27.0.3"
minSdkVersion 16
targetSdkVersion 27
How to do that at React Expo?
Update 1
after reading from developer.android.com
When you upload an APK, it needs to meet Google Play’s target API
level requirements. Starting August 1, 2019, Google Play requires that
new apps target at least Android 9.0 (API level 28), and that app
updates target Android 9.0 from November 1, 2019. Until these dates,
new apps and app updates must target at least Android 8.0 (API level
26).
Still doesn't have any idea for that things.
Follow these steps:
Close your Expo CLI server
In app.json, change sdkVersion to "34.0.0"
In package.json, change these dependencies:
react-native to "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz"
expo to "^34.0.3"
react to "16.8.3" — (this exact version)
react-navigation to "^3.11.1"
jest-expo to "^34.0.0" (if you use it)
sentry-expo to "~1.13.0" (if you use it)
If you use react-navigation you should also run expo install react-native-gesture-handler react-native-reanimated
Delete your project’s node_modules directory and run npm install again or use yarn
Run expo start -c
After these steps, it should work.
Source: https://blog.expo.io/expo-sdk-34-is-now-available-4f7825239319
You need to change the sdkVersion property in your app.json and build the application again:
"sdkVersion": "34.0.0",
"platforms": [
"ios",
"android"
],
using the expo build:android -t app-bundle command.
Make sure you have the latest expo cli installed.
Here's the corresponding blog post.

ReactNative: Uncaught TypeError: Cannot read property 'forEach' of undefined, while building KitchenSink demo

I am trying to compile a 'kitchen-sink' demo, for 'react-native':
NativeBase-KitchenSink
, and I have followed the following links already:
Solution to "React native: Android project not found. Maybe run react-native android first?"
Solution to "Expo : Cannot find a module LogReporter"
That is, from the installation of 'npm' till the installation of required tools using 'Yarn'.
And now I am stuck myself:
a. I run the command npm install in the 'root directory' of this project.
b. Then I run expo start, I see that the problems addressed in link 1 and 2 have gone away.
c. Then when the browser is up, I issue expo build:android
The following error shows up:
[11:14:44] Checking if current build exists...
[11:14:48] No currently active or previous builds for this project.
[11:14:50] Publishing to channel 'default'...
[11:14:56] Building iOS bundle
[11:15:09] Building Android bundle
[11:15:20] Analyzing assets
[11:15:27] Uploading assets
[11:15:27] No assets to upload, skipped.
[11:15:27] Processing asset bundle patterns:
[11:15:27] - D:\Projects\ReactNativeProjects\AwesomeProject\**\*
[11:15:27] Cannot read property 'forEach' of undefined
[11:15:27] TypeError: Cannot read property 'forEach' of undefined
at C:\xdl#51.4.0\src\Project.js:903:26
at Generator.next (<anonymous>)
at step (C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:191)
at C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:361
Please help me know where I am wrong? Some posts say the code is correct.
[EDIT]:
I also did a new thing in my 'app.json', just before executing command react-native eject, to create Android and iOS folders:
(Note: It is not mandatory to issue the react-native eject command, as this will cause permanent change according to the documentations)
{
"expo": {
"name": "AwesomeProject",
"description": "A Kitchen Sink project.",
"slug": "AwesomeProject",
"privacy": "public",
"sdkVersion": "30.0.0",
"platforms": [
"ios",
"android"
],
"ios": {
"supportsTablet": true
},
"android": {
"package": "com.abhsax.first"
},
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/logo.png",
"splash": {
"image": "./assets/splashscreen.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
]
},
"changes": "----below are the changes----",
"name": "AwesomeProject",
"displayName": "AwesomeProject"
}
That is, just when I added:
"name": "AwesomeProject",
"displayName": "AwesomeProject"
at the bottom of my 'app.json'
the command react-native eject started working, which was not working earlier, as the output was:
App name must be defined in the app.json config file to define the
project name. It must not contain any spaces or dashes.
Clearly, it is the hybrid of two different versions of the package managers: 'Expo' and 'npm'.
But the 'forEach' error in the concern here, did not go away.
Further efforts done were useless, so I am not putting them here.
I shall keep on trying until I figure it out.
you have to upgrade the expo cli version
do npm install -g expo-cli
and then expo start again
I resolved this by knowing that I was again mixing up with the package managers: 'npm' and 'yarn', and this time you do not need 'expo' for time being or all-together, so modify your 'app.json', removing expo section.
All I had to do was to issue the following commands in order.
Add React Base
yarn add react-base --save
Install Peer Dependencies
The peer dependencies included from any 'npm' packages does not automatically get installed. Your application will not depend on it explicitly.
react-native link
In the case of this demo project, one dependency was missing:
react-native link react-native-vector-icons
Start Yarn
yarn start
Run on android device or simulator.
react-native run-android
[Note:] Java 8 is recommended to be installed instead of higher versions of Java. see: What to install? Java 8 or Java 10
I wish it helps.
Happy coding :-)
Try changing:
"assetBundlePatterns": ["**/*"] to "assetBundlePatterns": ["assets/*"]
in your app.json file.

CRNA build:android issues

I am trying to build an APK file for my CRNA project, using expo. The first issue is, it tries to build iOS every time. Why is it building iOS when I used exp build:android?
Second, iOS only succeeds in building occasionally. It usually hangs at 0%.
The output is below:
> exp build:android
[16:28:36] Making sure project is set up correctly...
-[16:28:38] Warning: Not using the Expo fork of react-native. See https://docs.expo.io/.
[16:28:38] Your project looks good!
[16:28:38] Checking if current build exists...
[16:28:39] No currently active or previous builds for this project.
[16:28:39] Unable to find an existing exp instance for this directory, starting a new one...
[16:28:40] Warning: Not using the Expo fork of react-native. See https://docs.expo.io/.
[16:28:42] Starting Metro Bundler on port 19001.
[16:28:42] Metro Bundler ready.
[16:28:43] Tunnel ready.
[16:28:43] Publishing to channel 'default'...
[16:28:44] Warning: Not using the Expo fork of react-native. See https://docs.expo.io/.
[16:28:44] Building iOS bundle
And then it hanngs indefinitely.
Has anyone came across any of these issues and have any advice?
My app.json is below
{
"expo": {
"sdkVersion": "27.0.0",
"icon": "./test-icon.png",
"entryPoint": "./AppEntry.js",
"ignoreNodeModulesValidation": true,
"packagerOpts": {
"config": "rn-cli.config.js",
"projectRoots": ""
},
"android":{
"package": "expo.android.package",
},
"ios":{
"bundleIdentifier": "expo.ios.package",
},
},
"privacy": "unlisted",
"platforms": ["ios", "android"],
"version": "1.0.0",
"orientation": "portrait"
}
expo version: 55.0.4
react-native version: 0.55.4

Categories

Resources