expo: APK Crashes On Startup

Summary

I’m having an issue where my Android app immediately crashes after downloading and installing the APK. There are no issues when I run npm run web or when I connect to it with the Expo Go app from my Pixel 5 Pro phone.

I’ve read a few suggestions that described that adaptiveIcon in app.json could be to blame, but I still get the same result when removing that object altogether. Looking at the build details on expo.dev, a few things stand out:

The expo-doctor is reporting a finding:

Running "expo doctor"

- Validating global prerequisites versions...
✔ Validating global prerequisites versions passed
- Checking for incompatible packages...
✔ Checking for incompatible packages passed
- Checking for conflicting global packages in project...
✔ Checking for conflicting global packages in project passed
- Verifying prebuild support package versions are compatible...
✖ Verifying prebuild support package versions are compatible failed

Issues:
[stderr] Expected package @expo/config-plugins@~6.0.0
[stderr] Found invalid:
[stderr] @expo/config-plugins@4.1.1
[stderr] (for more info, run: npm why @expo/config-plugins)

I’ve tried adding @expo/config-plugins@~6.0.0 explicitly in package.json but it still prefers 4.1.1 because of @expo/webpack-config. These package versions are verbatim from just running npx create-expo-app, so I’m not sure if I need to rebuild my entire dependency tree to satisfy this.

The only other issues I see is in the gradlew step, see file: Expo Debugging Full.txt

My question at this point is. Are there any smoking guns (culprits) for the cause of the crashing? If we need more detail, what is the best way to move forward?

Managed or bare workflow?

managed

What platform(s) does this occur on?

Android

Package versions

In package.json:

{
  "name": "beer-app",
  "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",
    "test": "npx jest"
  },
  "dependencies": {
    "@expo/vector-icons": "^13.0.0",
    "@expo/webpack-config": "^18.0.1",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/stack": "^6.3.16",
    "@testing-library/jest-native": "^5.4.2",
    "@testing-library/react-native": "^12.1.1",
    "@types/jest": "^29.5.1",
    "expo": "~48.0.11",
    "expo-status-bar": "~1.4.4",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.71.7",
    "react-native-element-dropdown": "^2.9.0",
    "react-native-paper": "^5.7.0",
    "react-native-svg": "13.4.0",
    "react-native-web": "~0.18.10",
    "react-test-renderer": "^18.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/react": "~18.0.27",
    "@types/react-native": "^0.71.6",
    "typescript": "^4.9.4"
  },
  "private": true
}

Environment

  expo-env-info 1.0.5 environment info:
    System:
      OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
      Shell: 5.8.1 - /usr/bin/zsh
    Binaries:
      Node: 18.14.0 - ~/.nvm/versions/node/v18.14.0/bin/node
      Yarn: 1.22.19 - ~/.nvm/versions/node/v18.14.0/bin/yarn
      npm: 9.3.1 - ~/.nvm/versions/node/v18.14.0/bin/npm
    npmPackages:
      @expo/webpack-config: ^18.0.1 => 18.0.4 
      expo: ~48.0.11 => 48.0.11 
      react: 18.2.0 => 18.2.0 
      react-dom: 18.2.0 => 18.2.0 
      react-native: 0.71.7 => 0.71.7 
      react-native-web: ~0.18.10 => 0.18.12 
    npmGlobalPackages:
      eas-cli: 3.10.2
    Expo Workflow: managed

Reproducible demo

https://github.com/ztroop/simple-beer-judge

Stacktrace (if a crash is involved)

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 29

Most upvoted comments

hey @GeorgiIvanovPXL @Wilmela I’m not sure ,if you do have the same problem you can check out this pr https://github.com/ztroop/simple-beer-judge/pull/1

Thanks for your response. I actually do have similar problem. In my case expo-doctor reports no error, my build using eas goes through smoothly but when I install the app on my redmi note 8 pro, it crashes immediately I launch and no way to see the error messages.

My app uses the latest SDK 49 and everything works well except after deployment.

I’m on expo managed flow not bare flow.

I forgot to update you guys, I found the solution. When an app crashes on startup, it’s most likely to be react reanimated package. Confirm you have these installed

npm install @react-navigation/native @react-navigation/stack react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context

If not, try to get the logcat and google the same to get some specific keywords. Follow my account or WhatsApp me +254105879839 I’ll help you out

Why don’t you guys post the solution in detail 🥺 I’m finally getting people with my problem!

Solution needed please. Thanks in advance.

@ztroop i made a pull request to your branch you can check it out

I can also confirm that running npm run android, connecting to the Android Studio emulator, and running the app - all works as expected. The only issue seems to be around the resulting APK creation itself.