Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expo React Native App crashing on android

Ever since I started programming in React Native with Expo, I have been using an ios physical device together with Expo app. I never had any major issues.

Now i wanted to start fixing any bugs on android, but when running the Expo app on my android physical device the Expo app crashes (shuts down) while downloading bundle. It doesn't print any errors into my console, so i don't even know where to start...

Here is my app.json:

{
  "expo": {
    "name": "PointoUserApp",
    "slug": "PointoUserApp",
    "version": "1.0.0",
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "orientation": "portrait",
    "icon": "./assets/Images/icon.png",
    "splash": {
      "image": "./assets/Images/splash.png",
      "resizeMode":"contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "bundleIdentifier": "com.meretc23.PointoUserApp"
    },
    "android":{
      
    },
    "web": {
      "favicon": "./assets/Images/favicon.png"
    }
  }
}

notice it is empty under android because i dont know what is required.

Below is my package.json file as well.

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@expo-google-fonts/inter": "^0.1.0",
    "@fortawesome/fontawesome-svg-core": "^1.2.30",
    "@fortawesome/free-brands-svg-icons": "^5.14.0",
    "@fortawesome/free-solid-svg-icons": "^5.14.0",
    "@fortawesome/react-native-fontawesome": "^0.2.5",
    "@ionic/react": "^5.3.1",
    "@react-native-community/art": "^1.2.0",
    "@react-native-community/async-storage": "~1.11.0",
    "@react-native-community/datetimepicker": "2.4.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-navigation/bottom-tabs": "^5.7.3",
    "@react-navigation/material-top-tabs": "^5.2.16",
    "@react-navigation/native": "^5.7.2",
    "@react-navigation/stack": "^5.8.0",
    "@types/react-native-snap-carousel": "^3.8.2",
    "core-js": "^3.6.5",
    "expo": "^38.0.0",
    "expo-constants": "~9.1.1",
    "expo-font": "~8.2.1",
    "expo-linking": "^1.0.3",
    "expo-localization": "~8.2.1",
    "expo-location": "~8.2.1",
    "expo-permissions": "~9.0.1",
    "expo-status-bar": "^1.0.0",
    "firebase": "^7.21.1",
    "geolib": "^3.3.1",
    "i18n-js": "^3.7.1",
    "react": "16.11.0",
    "react-dom": "16.11.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
    "react-native-check-box": "^2.1.7",
    "react-native-gesture-handler": "~1.6.0",
    "react-native-localize": "^1.4.1",
    "react-native-map-clustering": "^3.3.9",
    "react-native-map-link": "^2.7.17",
    "react-native-maps": "0.27.1",
    "react-native-modal": "^11.5.6",
    "react-native-picker-select": "^8.0.0",
    "react-native-progress": "^4.1.2",
    "react-native-progress-circle": "^2.1.0",
    "react-native-qrcode-svg": "^6.0.6",
    "react-native-reanimated": "~1.9.0",
    "react-native-restart": "0.0.17",
    "react-native-safe-area-context": "^3.0.7",
    "react-native-screens": "~2.9.0",
    "react-native-snap-carousel": "^4.0.0-beta.5",
    "react-native-svg": "12.1.0",
    "react-native-tab-view": "^2.15.1",
    "react-native-web": "~0.11.7",
    "react-navigation": "^4.4.0",
    "react-navigation-stack": "^2.8.2",
    "react-redux": "^7.2.1",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0",
    "yargs-parser": "^18.1.3"
  },
  "devDependencies": {
    "@babel/core": "^7.8.6",
    "babel-preset-expo": "^8.2.3"
  },
  "private": true
}

Lesson learned: if you want to run an app on both ios and android, always monitor on both simultaneously before your app is too big to know where the issue is coming from....

Help appreciated

like image 779
Mireia Avatar asked Mar 15 '26 00:03

Mireia


1 Answers

I'm running into the same issue right now. In my situation I've narrowed it down to the android adaptiveIcon configuration. If I use a path to a real png, the app crashes on bundle download. If I don't include adaptiveIcon under android, the app crashes. The only way it won't crash is to include adaptiveIcon linked to a file that doesn't even exist. This logs an error that Expo can't find the file, but the app will actually load. Extremely strange. Try adding this to your app.json file.

"android": {
  "adaptiveIcon": {
    "foregroundImage": "./assets/anImageThatDoesNotExist.png",
    "backgroundColor": "#FFFFFF"
   }
 },
like image 138
addisonian Avatar answered Mar 16 '26 13:03

addisonian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!