Expo EAS build android apk crash on physical device

Viewed 942

I built eas -p android --profile luna. Then, I downloaded into physical device. When open it, the app crashes after showing splash screen. Expo SDK 45.0.0.
I tried to change eas.json profile. Here is what I tried.

"luna": {
  "android": {
    "buildType": "apk",
    "distribution": "internal"
  }
}

"luna": {
  "android": {
    "buildType": "apk",
    "distribution": "internal",
    "gradleCommand": ":app:assembleRelease"
  }
}

"luna": {
  "android": {
    "buildType": "apk"
  }
},

"luna": {
  "android": {
    "buildType": "apk",
    "developmentClient": true
  }
},

DevelopmentClient one can be opened but not the one I want.
Can someone tell or direct or advice me

  1. How to build apk with eas for physical device
  2. Should I downgrade to Expo SDK 44.0.0 and use expo build:android?
  3. How to create apk for physical device without expo (like ejecting expo)
  4. expo build classic build will be removed completely. Should I build react-native app without expo in the future?

my package.json file.

 "dependencies": {
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.1.2",
    "@react-native-community/netinfo": "8.2.0",
    "@react-native-masked-view/masked-view": "0.2.6",
    "@react-navigation/material-top-tabs": "^6.2.1",
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/stack": "^6.2.1",
    "expo": "~45.0.0",
    "expo-splash-screen": "~0.15.1",
    "expo-sqlite": "~10.2.0",
    "expo-status-bar": "~1.3.0",
    "firebase": "^9.8.1",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-collapsible": "^1.6.0",
    "react-native-gesture-handler": "~2.2.1",
    "react-native-modal-datetime-picker": "^13.1.2",
    "react-native-pager-view": "5.4.15",
    "react-native-safe-area-view": "^1.1.1",
    "react-native-screens": "~3.11.1",
    "react-native-svg": "12.3.0",
    "react-native-web": "0.17.7",
    "victory-native": "^36.4.1",
    "expo-dev-client": "~0.9.6"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/react-native": "^0.67.7",
    "babel-plugin-root-import": "^6.6.0"
  },
2 Answers

You can try to log your errors. The first step I would recommend you to take is connecting your device (having USB debugging active) to your PC, go to where your adb is installed, open a CMD/PowerShell window in that folder, run adb logcat *:S ReactNative:V ReactNativeJS:V, and try to open the app that crashes to see what it logs when it does.

An issue that I've had was that there was a problem with some dependency that EAS was adding during the build, so I installed it (react-native-reanimated@^2.8.0) separately through npm i, and then my build worked with EAS.

as gusti mentioned you need to debug your application then you can locate the problem and fix it. For me the problem was that I needed to install a package called "react-native-safe-area-context" by:

  • npm install react-native-safe-area-context then run expo doctor --fix-dependencies to make it compatible with your sdk version.
  • or directly run expo install react-native-safe-area-context

if it didn't work try to run expo update it will upgrade the sdk version and reinstall all the packages to make them compatible with the new version.

This was my problem you might face a different one, but you just need to read the error message and fix it.

Related