Expo react native apk keeps stopping after being installed

I build apk expo react native app, after being installed on mobile and try to open it crashes with message says app keeps stopping. How can i solve this since the app works fine on emulator no errors ? please anybody help me!
This is package.json
{
“name”: “fishingapp”,
“version”: “1.0.0”,
“main”: “index.js”,
“scripts”: {
“start”: “expo start --dev-client”,
“android”: “expo run:android”,
“ios”: “expo run:ios”,
“web”: “expo start --web”
},
“dependencies”: {
@react-navigation/drawer”: “^6.6.2”,
@react-navigation/stack”: “^6.3.16”,
“expo”: “~48.0.18”,
“expo-constants”: “~14.2.1”,
“expo-splash-screen”: “~0.18.2”,
“expo-status-bar”: “~1.4.4”,
“react”: “18.2.0”,
“react-native”: “^0.71.8”,
“react-native-gesture-handler”: “^2.9.0”,
“react-native-gradle-plugin”: “^0.71.19”,
“react-native-paper”: “^5.8.0”,
“react-native-reanimated”: “^2.14.4”,
“react-native-safe-area-context”: “^4.5.0”,
“react-native-unordered-list”: “^1.0.4”,
“react-native-vector-icons”: “^9.2.0”
},
“devDependencies”: {
@babel/core”: “^7.20.0”
},
“private”: true
}

@masoudcodes Try running your app in release mode using this command: npx react-native run-android --variant=release and use the adb logs to see the error crashing your app.

It ends with the following after using npx react-native run-android --variant=release
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the gradle.properties file or use the new publishing DSL.

Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
/var/www/html/HEETPROJECTS/Fishing/node_modules/react-native-reanimated/android/react-native-reanimated-71-hermes.aar
5 actionable tasks: 5 executed

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘:react-native-screens’.

Could not resolve all files for configuration ‘:react-native-screens:classpath’.
Could not download gradle-4.2.2.jar (com.android.tools.build:gradle:4.2.2)
Premature end of Content-Length delimited message body (expected: 6,849,329; received: 4,456,416)

  • Try:

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.

BUILD FAILED in 9m 41s

error Failed to install the app. Make sure you have the Android development environment set up: Setting up the development environment · React Native.
Error: Command failed: ./gradlew app:installRelease -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘:react-native-screens’.

Could not resolve all files for configuration ‘:react-native-screens:classpath’.
Could not download gradle-4.2.2.jar (com.android.tools.build:gradle:4.2.2)
Could not get resource ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.2.2/gradle-4.2.2.jar’.
Premature end of Content-Length delimited message body (expected: 6,849,329; received: 4,456,416)

  • Try:

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.

BUILD FAILED in 9m 41s

at makeError (/var/www/html/HEETPROJECTS/Fishing/node_modules/execa/index.js:174:9)
at /var/www/html/HEETPROJECTS/Fishing/node_modules/execa/index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (/var/www/html/HEETPROJECTS/Fishing/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:82:7)
at async Command.handleAction (/var/www/html/HEETPROJECTS/Fishing/node_modules/@react-native-community/cli/build/index.js:108:9)

info Run CLI with --verbose flag for more details.

I think you are missing the react-native-screens library which is required by react navigation

Finaly it says
Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.

BUILD SUCCESSFUL in 12m 59s
296 actionable tasks: 158 executed, 138 up-to-date
info Connecting to the development server…
8081
info Starting the app…
Starting: Intent { cmp=com.fishing/.MainActivity }

Thank you very much now it works fine, if I encounter any issue i still ask your help!

1 Like

Awesome!