androidreact-nativeexpocrasheas

React native expo app successfully built but crashes immediatly with apk installed on android device


I really need some help with my app. I could build my react native app apk successfully with "eas build -p android --profile preview", but the app crashes immediately after installing on the android device. I tried to rebuild the app several times with a brand new expo project and only add a few pages on it, but it still crashes after built.

There is no error or warning, and the app works fine on expo simulators, as well as expo simulator on physical device. It only crashes after built and installed on real devices.

I connected the device to monitor the log with logcat, but I only got the following log, which doesn't give me any specific clue about the error in my code:

08-23 15:22:29.036  6078  6130 E AndroidRuntime: Process: com.oki.okieventapp, PID: 6078
08-23 15:22:29.055  1173  6146 W ActivityManager: crash : com.oki.okieventapp,10352
08-23 15:22:29.058  1173  1259 W ActivityTaskManager:   Force finishing activity com.oki.okieventapp/.MainActivity

This is my package.json:

{
  "name": "eventapp0828",
  "version": "1.0.0",
  "main": "expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-navigation/bottom-tabs": "^6.6.1",
    "@react-navigation/native": "^6.1.17",
    "@react-navigation/native-stack": "^6.9.26",
    "@react-navigation/stack": "^6.3.29",
    "contentful": "^10.8.7",
    "expo": "~51.0.28",
    "expo-status-bar": "~1.12.1",
    "react": "18.2.0",
    "react-native": "0.74.5"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "private": true
}

This is my app.json:

{
  "expo": {
    "name": "Oki Event App",
    "slug": "eventieapp",
    "version": "1.0.4",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.oki.okieventapp"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/splash.png",
        "backgroundColor": "#ffffff"
      },
      "package": "com.oki.okieventapp",
      "versionCode": 8
    },
    "web": {
      "favicon": "./assets/splash.png"
    }
  }
}

Could anyone help me with this app crash issue please? Thank you in advance!🥹


Solution

  • You can try installing these packages. Your app should work properly in build mode as well. react-native-gesture-handler react-native-screens react-native-safe-area-context