Expo build failed for android - android

I'm building a react native app that is using the ble plx library.
For that I think it got ejected.
Now I'm trying to publish a internal test in the google play store.
I ran the command expo build -p android to create an apk for this purpose and got the error message:
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':expo-updates:kaptReleaseKotlin'.
[stderr] > A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
[stderr] > java.lang.reflect.InvocationTargetException (no error message)
[stderr] * Try:
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 6m 13s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
389 actionable tasks: 389 executed
Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.
Package.json:
{
"name": "app",
"version": "0.0.4",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#config-plugins/react-native-ble-plx": "^0.0.2",
"#ethersproject/shims": "^5.5.0",
"#expo/vector-icons": "^12.0.0",
"#react-native-clipboard/clipboard": "^1.8.5",
"#react-navigation/bottom-tabs": "^6.2.0",
"#react-navigation/native": "^6.0.8",
"#react-navigation/native-stack": "^6.4.1",
"#reduxjs/toolkit": "^1.7.2",
"base64-arraybuffer": "^1.0.1",
"ethers": "^5.5.4",
"expo": "^44.0.0",
"expo-asset": "~8.4.6",
"expo-constants": "~13.0.1",
"expo-dev-client": "~0.8.4",
"expo-font": "~10.0.4",
"expo-linking": "~3.0.0",
"expo-random": "~12.1.1",
"expo-secure-store": "~11.1.0",
"expo-splash-screen": "~0.14.1",
"expo-status-bar": "~1.2.0",
"expo-updates": "~0.11.6",
"expo-web-browser": "~10.1.0",
"moment": "^2.29.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-ble-plx": "^2.0.3",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "~2.1.0",
"react-native-get-random-values": "~1.7.0",
"react-native-keep-awake": "^4.0.0",
"react-native-nfc-manager": "^3.13.2",
"react-native-pager-view": "^6.0.0-rc.1",
"react-native-paper": "^4.11.2",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-snackbar": "^2.4.0",
"react-native-step-indicator": "^1.0.3",
"react-native-video": "^5.2.0",
"react-native-web": "0.17.1",
"react-redux": "^7.2.6"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#types/react": "~17.0.21",
"#types/react-native": "~0.64.12",
"#types/react-native-keep-awake": "^2.0.3",
"#types/react-native-video": "^5.0.13",
"#typescript-eslint/eslint-plugin": "^5.10.2",
"#typescript-eslint/parser": "^5.10.2",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-react": "^7.27.1",
"jest-expo": "^44.0.0",
"json-server": "^0.17.0",
"prettier": "^2.5.1",
"typescript": "~4.3.5"
},
"private": true
}
I tried to run eas build as well but it failed with the same error.
I could guess it's because the app is ejected but I'm not sure how to fix this.
How can I build successfully?

My problem was fixed by adding "image" : "latest" to the eas config.
It seems like the jdk used by default has a bug that prevents from building for release.

Related

RL - Eas build apk error: Don't know which android drawable suffix to use for asset

I am maintaining the RL app.
After modifying the code, I want to test it by building it with apk.
I'm going to create an apk using eas build -p android --profile preview. (This is my first time using Eas Build).
However, the following error occurs during the build:
> Task :app:bundleReleaseJsAndAssets FAILED
[stderr] error Don't know which android drawable suffix to use for asset: {"__packager_asset":true,"fileSystemLocation":"/home/expo/workingdir/build/assets/images/navigation/service","httpServerLocation":"/assets/assets/images/navigation/service","width":320,"height":130,"scales":[1,2,3,4,5],"files":["/home/expo/workingdir/build/assets/images/navigation/service/reservation_thum_img_1.png","/home/expo/workingdir/build/assets/images/navigation/service/reservation_thum_img_1#2x.png","/home/expo/workingdir/build/assets/images/navigation/service/reservation_thum_img_1#3x.png","/home/expo/workingdir/build/assets/images/navigation/service/reservation_thum_img_1#4x.png","/home/expo/workingdir/build/assets/images/navigation/service/reservation_thum_img_1#5x.png"],"hash":"b74c4d596b7a00b174f1cbbf6373edac","name":"reservation_thum_img_1","type":"png","fileHashes":["f8e111b8eadda7d33612a89b3337968d","08bbb315b8db585383bafaf3bbbb159f","b410e37fc8c275c98f2b07711193b9d2","5bc21bf4e96ae2a26d0f1f41a0bb9dc8","f9883a5447a863dde859d547da0c0fe7"]}.
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 3 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
933 actionable tasks: 933 executed
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:bundleReleaseJsAndAssets'.
[stderr] > Process 'command 'node'' finished with non-zero exit value 1
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 12m 49s
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
It's my package.json and eas.json code
// package.json
{
"name": "my-app",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"resolutions": {},
"dependencies": {
"#expo/react-native-action-sheet": "^4.0.1",
"#expo/samples": "~3.0.3",
"#expo/vector-icons": "^13.0.0",
"#fortawesome/fontawesome-svg-core": "^6.2.1",
"#fortawesome/free-solid-svg-icons": "^6.2.1",
"#fortawesome/react-native-fontawesome": "^0.3.0",
"#react-native-async-storage/async-storage": "^1.17.11",
"#react-native-community/datetimepicker": "6.1.2",
"axios": "^1.2.6",
"crypto-js": "^4.1.1",
"expo": "^45.0.0",
"expo-app-loading": "~2.0.0",
"expo-asset": "~8.5.0",
"expo-blur": "~11.1.0",
"expo-camera": "~12.2.0",
"expo-cli": "^6.2.1",
"expo-constants": "~13.1.1",
"expo-file-system": "~14.0.0",
"expo-font": "~10.1.0",
"expo-image-manipulator": "~10.3.1",
"expo-image-picker": "~13.1.1",
"expo-linking": "~3.1.0",
"expo-location": "~14.2.2",
"expo-notifications": "~0.15.4",
"expo-splash-screen": "^0.15.1",
"expo-status-bar": "~1.3.0",
"expo-updates": "~0.13.4",
"expo-web-browser": "~10.2.1",
"global": "^4.4.0",
"immutable": "^4.2.2",
"intl": "^1.2.5",
"jwt-decode": "^3.1.2",
"moment": "^2.29.4",
"qs": "^6.11.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-geocode": "^0.2.3",
"react-native": "0.68.2",
"react-native-dash": "^0.0.11",
"react-native-easy-toast": "^2.3.0",
"react-native-elements": "^3.4.3",
"react-native-gesture-handler": "~2.2.1",
"react-native-image-resizer": "^1.0.1",
"react-native-maps": "0.30.2",
"react-native-measureme": "^0.0.2",
"react-native-modal": "^13.0.1",
"react-native-modal-datetime-picker": "^14.0.1",
"react-native-picker-select": "^8.0.4",
"react-native-push-notification-popup": "^1.6.1",
"react-native-qrcode": "^0.2.7",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1",
"react-native-status-bar-height": "^2.6.0",
"react-native-svg": "12.3.0",
"react-native-svg-transformer": "^1.0.0",
"react-native-web": "0.17.7",
"react-native-webview": "11.18.1",
"react-navigation": "^3.11.0",
"react-redux": "^8.0.5",
"redux": "^4.2.1",
"redux-actions": "^2.6.5",
"redux-devtools-extension": "^2.13.8",
"redux-pender": "^2.0.12",
"underscore": "^1.13.6"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
.
// eas.json
{
"cli": {
"version": ">= 3.5.2"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {
"android": {
"buildType": "apk"
}
}
},
"submit": {
"production": {}
}
}
May I know the cause and solution for this problem?
Thank you.
I think this is a duplicate of this question. Please try the solutions provided for this question.
Question link: Detected multiple Kotlin daemon sessions at build\kotlin\sessions - React-Native

My Expo stuck at splash screen after building it for android

I have used eas buidl -p android --profile preview to build my .apk file. But I am not getting why app is stuck at Splash Screen. I am not getting what is the cause. Please help me out and thank you in advance.
my pcakage.json
"name": "appName-mob",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"build": "eas build -p android"
},
"dependencies": {
"#expo-google-fonts/inter": "^0.2.2",
"#expo/vector-icons": "^13.0.0",
"#react-native-community/netinfo": "9.3.0",
"#react-navigation/bottom-tabs": "^6.3.3",
"#react-navigation/native": "^6.0.12",
"#react-navigation/native-stack": "^6.8.0",
"#tanstack/react-query": "^4.3.9",
"axios": "^0.27.2",
"expo": "~46.0.9",
"expo-app-loading": "~2.1.0",
"expo-font": "~10.2.0",
"expo-splash-screen": "~0.16.2",
"expo-status-bar": "~1.4.0",
"react": "18.0.0",
"react-icons": "^4.4.0",
"react-native": "0.69.6",
"react-native-gesture-handler": "~2.5.0",
"react-native-safe-area-context": "4.3.1",
"react-native-svg": "12.3.0",
"react-native-svg-transformer": "^1.0.0",
"react-native-view-more-text": "^2.1.0",
"expo-linear-gradient": "~11.4.0",
"#react-native-async-storage/async-storage": "~1.17.3"
},
"devDependencies": {
"#babel/core": "^7.18.6",
"babel-loader": "^8.2.5",
"babel-plugin-module-resolver": "^4.1.0",
"babel-preset-react-native": "^4.0.1",
"path": "^0.12.7"
},
"private": true
}```
in development mode clear application cache and storage then test your app
Thank you for your time. But this problem has been solved. Actually it wasn't a problem in the development server. So, I made a development build and ran my code there and got the log of UIManager Issue which was then resolved by installing react-native-screens. I would suggest if this happen to any of you again just make a development build and test your code there. It was very much helpful.

Stuck on black screen when activating debug in React-Native

I have a problem with my RN app in my android device (have not tested on iOS yet), as soon as I activate debug on the device, it gets stuck on a black screen.
I dont know what part of the code or what setting is causing this, and this is the reason I am not showing any coding here. Just trying to check if you guys have had the same problem before.
Here is what I have tried:
gradlew clean
react-native start --reset-cache
cleaned app data and cache in the device
uninstalled the app from the device
Here are the packages I have installed and using so far on my app:
{
"name": "bleconnect",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#ant-design/icons": "^4.7.0",
"#react-native-async-storage/async-storage": "^1.15.14",
"#react-native-community/blur": "^3.6.0",
"#react-native-community/masked-view": "^0.1.11",
"#react-native-firebase/app": "^14.7.0",
"#react-native-firebase/auth": "^14.2.1",
"#react-native-firebase/firestore": "^12.4.0",
"#react-native-firebase/functions": "^14.2.1",
"#react-native-firebase/storage": "^14.7.0",
"#react-navigation/drawer": "^6.3.1",
"#react-navigation/native": "^6.0.6",
"#react-navigation/stack": "^6.0.11",
"evil-icons": "^1.10.1",
"geofirestore": "^4.4.2",
"haversine": "^1.1.1",
"node": "^16.13.1",
"npm-check-updates": "^12.4.0",
"react": "17.0.1",
"react-chat-elements": "^11.0.1",
"react-content-loader": "^6.2.0",
"react-native": "0.64.2",
"react-native-animated-spinkit": "^1.5.2",
"react-native-countdown-circle-timer": "^3.0.6",
"react-native-device-info": "^8.1.5",
"react-native-elements": "^3.4.2",
"react-native-fast-image": "^8.5.11",
"react-native-gesture-handler": "^2.1.0",
"react-native-grid-image-viewer": "^1.3.0",
"react-native-image-crop-picker": "^0.37.3",
"react-native-image-picker": "^4.7.3",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-location": "^2.5.0",
"react-native-permissions": "^3.3.1",
"react-native-reanimated": "^2.8.0",
"react-native-reanimated-carousel": "^2.4.0",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.10.2",
"react-native-svg": "^12.3.0",
"react-native-vector-icons": "^8.1.0"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"react-test-renderer": "17.0.1"
},
"jest": {
"preset": "react-native"
}
}
I would try to npm uninstall all packages and reinstall latest of all but there are specific versions of some libraries that I am using so I cant updated everything to the latest versions.
I have found a workaround. I force downgraded react-native-reanimated package to 2.2.4 and now the debugger works just fine.
npm i react-native-reanimated#2.2.4 --force
if you dont use --force command, it might fail downgrading.
try to run your project with android studio,i think it has errors that will show here.

React native app crash without error log ,How to detect a bug?

I'm developing an android app in react native and it is crash when I install it to my android device, my android device is running on android 10.
package.json
{
"name": "WifiSwitch",
"version": "0.0.2",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/async-storage": "^1.12.1",
"#react-native-community/masked-view": "^0.1.10",
"#react-native-community/viewpager": "^5.0.11",
"#react-navigation/native": "^5.8.10",
"#react-navigation/stack": "^5.12.8",
"axios": "^0.21.1",
"native-base": "^2.15.0",
"react": "16.13.1",
"react-native": "^0.65.1",
"react-native-android-wifi": "^0.0.41",
"react-native-best-viewpager": "^1.0.4",
"react-native-gesture-handler": "^1.9.0",
"react-native-image-picker": "^4.0.6",
"react-native-reanimated": "^1.13.2",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.16.1",
"react-native-tcp-socket": "^4.5.5",
"react-native-uuid": "^2.0.1",
"react-native-vector-icons": "^7.1.0"
},
"devDependencies": {
"#babel/core": "^7.12.10",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.17.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
I recommend you to debug your application using adb logcat
Steps to configure
Connect your device to your computer
Run adb devices to check out if your device is detected.
If the command doesn't work because "adb is not a command", go to your ANDROID_HOME path, then open platform-tools
Now run adb logcat: This command will output all logs (debug and error levels) coming from your Android Device.
Install your application again. I recommend you to use react-native run-android. More info: https://reactnative.dev/docs/running-on-device
When your app is going to crash, you will see a Crash Log in the adb logcat output. Search for your app package name.
For your convenience, you could as well have a look here to filter only your app: Filter LogCat to get only the messages from My Application in Android?
Whenever you get a crash log, a stack trace is also provided. That can help you trace the issue.

Release APK crash on start - React Native

I have an issue with react native release APK.
The app run on debug mode but it crash immediately on release mode
Got these message from the logcat which is probably causing this problem
Module AppRegistry is not a registered callable module (calling unmountApplicationComponentAtRootTag)
11-01 08:28:24.531 6644 6662 E ReactNativeJS: undefined is not an object (evaluating 'd.View.propTypes.style')
11-01 08:28:24.534 6644 6662 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)
Here is my packages :
{
"name": "jbw",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"color": "^2.0.0",
"intl": "^1.2.5",
"native-base": "^2.3.3",
"prop-types": "^15.6.0",
"react": "16.0.0-beta.5",
"react-native": "0.49.3",
"react-native-fontawesome": "^5.7.0",
"react-native-keyboard-aware-scroll-view": "^0.4.1",
"react-native-linear-gradient": "^2.3.0",
"react-native-loading-spinner-overlay": "^0.5.2",
"react-native-masked-text": "^1.6.2",
"react-native-modal": "^4.1.1",
"react-native-popup-dialog": "^0.9.38",
"react-native-super-grid": "^1.0.4",
"react-native-vector-icons": "^4.4.2",
"react-navigation": "^1.0.0-beta.15"
},
"devDependencies": {
"babel-jest": "21.2.0",
"babel-preset-react-native": "4.0.0",
"jest": "21.2.1",
"react-test-renderer": "16.0.0-beta.5"
},
"jest": {
"preset": "react-native"
}
}
Got the problem, caused by
View.PropTypes
deprecated on 0.49
should move to
import { ViewPropTypes } from 'react-native';
Try to do the following steps:
cd android
sudo ./gradlew clean
If not works, you can check your index.android.js on the line:
AppRegistry.registerComponent('MyAppName', () => MyRootComponent);
Verify if the name in (MyAppName) is the same of the name that are in MainActivity.java in the method getMainComponentName()
just make sure that you have:
"react-native": "0.50.3",
"react": "^16.0.0"
then do:
watchman watch-del-all
cd android
./gradlew clean
./gradlew assembleDebug
and everything will work well
credit to: #mobdim https://github.com/facebook/react-native/issues/16745#issuecomment-343443988
i should mention that i had to fix also the problem mentioned here by Ganesh Cauda

Categories

Resources