Android build succeeds, app won't open

The build succeeds locally & on EAS in dev and prod environments, but app won’t open.

  • runs fine with no errors in the Android simulator
  • recently upgraded to ~49.0.10
  • local node version: 16.18.1
  • Mac OS X 13.4

npx expo-doctor: all valid :heavy_check_mark:

package.json:

{
  "name": "native",
  "main": "index.js",
  "private": true,
  "version": "0.4.9",
  "engine": {
    "node": ">16"
  },
  "scripts": {
    "dev": "expo start",
    "start": "expo start",
    "ios": "expo run:ios",
    "android": "expo run:android",
    "web": "expo start --web",
    "eject": "expo eject",
    "postinstall": "rm -rf ./node_modules/expo/node_modules/expo-font/",
    "lint": "eslint . --ext .ts,.tsx"
  },
  "resolutions": {
    "@expo/config-plugins": "~7.2.2",
    "@expo/prebuild-config": "~6.2.4"
  },
  "dependencies": {
    "@babel/preset-env": "7.22.10",
    "@contentful/rich-text-react-renderer": "^15.0.0",
    "@contentful/rich-text-types": "^15.0.0",
    "@fortawesome/fontawesome-svg-core": "6.1.0",
    "@fortawesome/free-brands-svg-icons": "^5.15.4",
    "@fortawesome/pro-duotone-svg-icons": "^5.15.4",
    "@fortawesome/pro-light-svg-icons": "^5.15.4",
    "@fortawesome/pro-regular-svg-icons": "^5.15.4",
    "@fortawesome/pro-solid-svg-icons": "^5.15.4",
    "@fortawesome/react-native-fontawesome": "^0.2.7",
    "@gorhom/bottom-sheet": "4.4.7",
    "@gorhom/portal": "1.0.14",
    "@react-native-async-storage/async-storage": "1.18.2",
    "@react-native-community/datetimepicker": "7.2.0",
    "@react-native-firebase/analytics": "^18.1.0",
    "@react-native-firebase/app": "18.4.0",
    "@react-native-masked-view/masked-view": "0.2.9",
    "@react-native-picker/picker": "2.4.10",
    "@react-navigation/bottom-tabs": "^5.11.8",
    "@react-navigation/native": "^5.9.3",
    "@react-navigation/stack": "^5.14.3",
    "@reduxjs/toolkit": "^1.5.0",
    "@types/semver": "7.5.1",
    "axios": "^0.21.1",
    "babel-preset-expo": "^9.5.0",
    "card-validator": "^8.1.1",
    "color": "^3.1.3",
    "date-fns": "^2.22.1",
    "date-fns-timezone": "^0.1.4",
    "dotenv": "16.3.1",
    "expo": "~49.0.10",
    "expo-app-loading": "~2.1.0",
    "expo-application": "~5.3.0",
    "expo-asset": "~8.10.1",
    "expo-auth-session": "~5.0.2",
    "expo-build-properties": "~0.8.3",
    "expo-clipboard": "~4.3.1",
    "expo-constants": "~14.4.2",
    "expo-dev-client": "~2.4.10",
    "expo-device": "~5.4.0",
    "expo-font": "~11.4.0",
    "expo-haptics": "~12.4.0",
    "expo-image-picker": "~14.3.2",
    "expo-linking": "~5.0.2",
    "expo-media-library": "~15.4.1",
    "expo-print": "~12.4.2",
    "expo-random": "~13.2.0",
    "expo-screen-orientation": "~6.0.5",
    "expo-secure-store": "~12.3.1",
    "expo-sharing": "~11.5.0",
    "expo-splash-screen": "~0.20.5",
    "expo-status-bar": "~1.6.0",
    "expo-tracking-transparency": "~3.1.0",
    "expo-updates": "0.18.13",
    "expo-web-browser": "~12.3.2",
    "firebase": "10.4.0",
    "firebase-ios-sdk": "5.7.1",
    "formik": "^2.2.6",
    "lodash": "^4.17.21",
    "polished": "4.2.2",
    "prop-types": "^15.7.2",
    "ramda": "^0.27.1",
    "react": "18.2.0",
    "react-content-loader": "^6.0.3",
    "react-dom": "18.2.0",
    "react-native": "0.72.4",
    "react-native-gesture-handler": "~2.12.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.4",
    "react-native-reanimated": "~3.3.0",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-svg": "13.9.0",
    "react-native-wallet-manager": "0.0.3",
    "react-native-web": "~0.19.6",
    "react-native-webview": "13.2.2",
    "react-redux": "^7.2.2",
    "redux-persist": "^6.0.0",
    "redux-persist-expo-securestore": "2.0.0",
    "semver": "7.5.4",
    "sentry-expo": "~7.0.0",
    "styled-components": "^5.2.1",
    "uuid": "7.0.0",
    "yup": "^0.32.9"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/runtime": "^7.8.4",
    "@expo/config-plugins": "~7.2.2",
    "@expo/prebuild-config": "~6.2.4",
    "@types/react": "~18.2.14",
    "@types/styled-components": "5.1.26",
    "@types/styled-components-react-native": "5.2.1",
    "babel-jest": "^25.1.0",
    "babel-loader": "^8.1.0",
    "babel-plugin-emotion": "^10.0.33",
    "babel-plugin-module-resolver": "^4.1.0",
    "babel-preset-react": "^6.24.1",
    "eslint": "^7.11.0",
    "eslint-plugin-prettier": "^3.1.4",
    "eslint-plugin-react": "^7.21.4",
    "metro-react-native-babel-preset": "^0.59.0",
    "prettier": "^2.2.1",
    "react-native-dotenv": "3.4.8",
    "typescript": "^5.1.3"
  }
}

app.config.js:

module.exports = function config(api) {
    if (process.env.ENV === "production") {
      return {
        expo: {
          scheme: ["safetywing-prod", "fb111483766232696"],
          name: "SafetyWing",
          slug: "SafetyWing",
          owner: "safetynest",
          version: "0.4.9",
          orientation: "portrait",
          icon: "./assets/icon.png",
          splash: {
            image: "./assets/splash.png",
            resizeMode: "cover",
            backgroundColor: "#273C49"
          },
          updates: {
            fallbackToCacheTimeout: 0
          },
          assetBundlePatterns: ["**/*"],
          plugins: [
            ["expo-updates",
              {
                "username": "aaronsmulktis"
              }
            ],
            ["sentry-expo"],
            ["@react-native-firebase/app"],
            [
              "expo-build-properties",
              {
                ios: {
                  useFrameworks: "static",
                },
              },
            ],
            [
              "expo-tracking-transparency",
              {
                userTrackingPermission:
                  "This is only to improve our product. We will never share or sell your information.",
              },
            ],
            [
              "expo-screen-orientation",
              {
                initialOrientation: "PORTRAIT",
                orientationLock: "PORTRAIT",
              },
            ],
          ],
          ios: {
            bundleIdentifier: "com.safetywing.nomadinsurance",
            googleServicesFile: "./GoogleService-Info.plist",
            buildNumber: "9",
            // entitlements: {
            //   'com.apple.developer.pass-type-identifiers': ['pass.com.safetywing.nomadinsurance'],
            // },
            supportsTablet: false,
            infoPlist: {
              NSCameraUsageDescription:
                "This app uses the camera to take photos of receipts when filing claims",
              NSPhotoLibraryUsageDescription:
                "This app uses the photo library to upload photos of receipts when filing claims"
            }
          },
          android: {
            versionCode: 9,
            googleServicesFile: "./google-services.json",
            // permissions: [
            //   "android.permission.BIND_QUICK_ACCESS_WALLET_SERVICE"
            // ],
            softwareKeyboardLayoutMode: "pan",
            adaptiveIcon: {
              foregroundImage: "./assets/adaptive-icon.png",
              backgroundColor: "#FFFFFF"
            },
            package: "com.safetywing.nomadinsurance"
          },
          web: {
            favicon: "./assets/favicon.png"
          },
          extra: {
            eas: {
              projectId: "64566671-2364-4706-b6ca-f82c7208d9b2"
            }
          }
        },
        hooks: {
          postPublish: [
            {
              file: "sentry-expo/upload-sourcemaps",
              config: {
                organization: "safetywing",
                project: "sw-mobile"
              }
            }
          ]
        }
      };
    } else {
      return {
        expo: {
          scheme: ["safetywing-dev", "fb111483766232696"],
          name: "SafetyWing (Dev)",
          slug: "SafetyWing",
          owner: "safetynest",
          version: "0.4.9",
          orientation: "portrait",
          icon: "./assets/icon.png",
          privacy: "unlisted",
          splash: {
            image: "./assets/splash.png",
            resizeMode: "cover",
            backgroundColor: "#273C49"
          },
          updates: {
            fallbackToCacheTimeout: 0
          },
          assetBundlePatterns: ["**/*"],
          plugins: [
            ["expo-updates",
              {
                "username": "aaronsmulktis"
              }
            ],
            ["sentry-expo"],
            ["@react-native-firebase/app"],
            [
              "expo-build-properties",
              {
                ios: {
                  useFrameworks: "static",
                },
              },
            ],
            [
              "expo-tracking-transparency",
              {
                userTrackingPermission:
                  "This is only to improve our product. We will never share or sell your information.",
              },
            ],
            [
              "expo-screen-orientation",
              {
                initialOrientation: "PORTRAIT",
                orientationLock: "PORTRAIT",
              },
            ],
          ],
          ios: {
            bundleIdentifier: "development.safetywing.nomadinsurance",
            googleServicesFile: "./GoogleService-Info.plist",
            buildNumber: "9",
            // entitlements: {
            //   'com.apple.developer.pass-type-identifiers': ['pass.com.safetywing.nomadinsurance'],
            // },
            supportsTablet: false,
            infoPlist: {
              NSCameraUsageDescription:
                "This app uses the camera to take photos of receipts when filing claims",
              NSPhotoLibraryUsageDescription:
                "This app uses the photo library to upload photos of receipts when filing claims"
            }
          },
          android: {
            versionCode: 9,
            googleServicesFile: "./google-services.json",
            // permissions: [
            //   "android.permission.BIND_QUICK_ACCESS_WALLET_SERVICE"
            // ],
            softwareKeyboardLayoutMode: "pan",
            adaptiveIcon: {
              foregroundImage: "./assets/adaptive-icon.png",
              backgroundColor: "#FFFFFF"
            },
            package: "com.safetywing.nomadinsurance"
          },
          web: {
            favicon: "./assets/favicon.png"
          },
          extra: {
            eas: {
              projectId: "64566671-2364-4706-b6ca-f82c7208d9b2"
            }
          }
        },
        hooks: {
          postPublish: [
            {
              file: "sentry-expo/upload-sourcemaps",
              config: {
                organization: "safetywing",
                project: "sw-mobile"
              }
            }
          ]
        }
      };
    }
  };

eas.json:

{
  "cli": {
    "version": ">= 3.1.1",
    "appVersionSource": "local"
  },
  "build": {
    "simulator": {
      "developmentClient": true,
      "distribution": "internal",
      "ios": {
        "simulator": true,
        "resourceClass": "m-medium"
      }
    },
    "dev": {
      "env": {
        "FIREBASE_PROJECT_NUMBER": "$FIREBASE_PROJECT_NUMBER",
        "FIREBASE_PROJECT_ID": "$FIREBASE_PROJECT_ID",
        "FIREBASE_STORAGE_BUCKET": "$FIREBASE_STORAGE_BUCKET",
        "FIREBASE_APP_ID": "$FIREBASE_APP_ID",
        "GOOGLE_BUNDLE_ID": "$GOOGLE_BUNDLE_ID",
        "GOOGLE_CLIENT_ID": "$GOOGLE_CLIENT_ID",
        "SENTRY_AUTH_TOKEN": "$SENTRY_AUTH_TOKEN",
        "SENTRY_ORG": "$SENTRY_ORG",
        "SENTRY_PROJECT": "$SENTRY_PROJECT",
        "SENTRY_DSN": "$SENTRY_DSN",
        "SENTRY_DEBUG": "$SENTRY_DEBUG",
        "ENV": "development",
        "ENTRY_FILE": "$ENTRY_FILE"
      },
      "developmentClient": true,
      "distribution": "internal",
      "ios": {
        "image": "macos-ventura-13.3-xcode-14.3",
        "buildConfiguration": "Debug",
        "resourceClass": "m-medium"
      },
      "android": {
        "buildType": "apk"
      }
    },
    "preview": {
      "env": {
        "DVTEnableCoreDevice": "enabled",
        "FIREBASE_PROJECT_NUMBER": "$FIREBASE_PROJECT_NUMBER",
        "FIREBASE_PROJECT_ID": "$FIREBASE_PROJECT_ID",
        "FIREBASE_STORAGE_BUCKET": "$FIREBASE_STORAGE_BUCKET",
        "FIREBASE_APP_ID": "$FIREBASE_APP_ID",
        "GOOGLE_BUNDLE_ID": "$GOOGLE_BUNDLE_ID",
        "GOOGLE_CLIENT_ID": "$GOOGLE_CLIENT_ID",
        "SENTRY_AUTH_TOKEN": "$SENTRY_AUTH_TOKEN",
        "SENTRY_ORG": "$SENTRY_ORG",
        "SENTRY_PROJECT": "$SENTRY_PROJECT",
        "SENTRY_DSN": "$SENTRY_DSN",
        "SENTRY_DEBUG": "$SENTRY_DEBUG",
        "ENV": "production",
        "ENTRY_FILE": "$ENTRY_FILE"
      },
      "channel": "preview",
      "distribution": "internal",
      "ios": {
        "image": "macos-ventura-13.3-xcode-14.3",
        "buildConfiguration": "Release",
        "resourceClass": "m-medium"
      },
      "android": {
        "buildType": "apk"
      }
    },
    "prod": {
      "env": {
        "DVTEnableCoreDevice": "enabled",
        "FIREBASE_PROJECT_NUMBER": "$FIREBASE_PROJECT_NUMBER",
        "FIREBASE_PROJECT_ID": "$FIREBASE_PROJECT_ID",
        "FIREBASE_STORAGE_BUCKET": "$FIREBASE_STORAGE_BUCKET",
        "FIREBASE_APP_ID": "$FIREBASE_APP_ID",
        "GOOGLE_BUNDLE_ID": "$GOOGLE_BUNDLE_ID",
        "GOOGLE_CLIENT_ID": "$GOOGLE_CLIENT_ID",
        "SENTRY_AUTH_TOKEN": "$SENTRY_AUTH_TOKEN",
        "SENTRY_ORG": "$SENTRY_ORG",
        "SENTRY_PROJECT": "$SENTRY_PROJECT",
        "SENTRY_DSN": "$SENTRY_DSN",
        "SENTRY_DEBUG": "$SENTRY_DEBUG",
        "ENV": "production",
        "ENTRY_FILE": "$ENTRY_FILE"
      },
      "channel": "prod",
      "distribution": "store",
      "ios": {
        "image": "latest",
        "buildConfiguration": "Release",
        "resourceClass": "m-medium"
      },
      "android": {
        "buildType": "app-bundle"
      }
    }
  },
  "submit": {
    "production": {}
  }
}

I’ve got sentry setup, but no errors or logs are ever reported because the app crashes before it even gets to the splash screen

Hi @aaronsmulktis

Have a look at this: Troubleshoot build errors and crashes

It’s worth looking through the whole thing, but a couple of things I want to highlight:

  • Try running using a dev build with npx expo start --no-dev --minify.
    This behaves much closer to a production build than just npx expo start, so it might give you an idea of what’s wrong.
  • Try running adb logcat -d to get the logs from the phone/emulator
    Search for “FATAL”

If all else fails, try to see if you can use a bisection search to figure out what’s causing the problem. i.e. comment out half your code to see if it still crashes. If it does, chances are the problem is in the remaining half. If not, chances are the problem is in the part you commented out. Then comment out half of the “bad” code, etc. See also expo.fyi/manual-debugging

EDIT: Why do you need this? It might indicate that you’re using some incompatible dependencies.

Also these dependencies:

As per the Expo SDK 45 release blog post:

It was still there in Expo SDK 46, but was removed in Expo SDK 47.

I have not used Firebase before, but I don’t believe you should have the firebase and firebase-ios-sdk dependencies installed. See also Use Firebase - Expo Documentation

As far as I know, prop-types are no longer a thing in current versions of React Native.

I believe this functionality is included in @babel/core

Do you need this? I suspect it can be removed.

1 Like

Thanks very much! I will investigate and take your advice on all this, and report back. Cheers and thanks again!

I had already poured over those docs you linked, but wasn’t getting anywhere… anyway the last build on Friday actually fixed whatever the issue was and the app is now running fine on my Pixel.

But I think you’re right about all these points. I upgraded to expo-splash-screen easily, and removed @expo/config-plugins & @expo/prebuild-config without any problem, I thought I needed them for the app.config.js plugins to work and had installed them back when I was trying to write my own plugin for some reason. Anyway thanks again @wodin!

1 Like

I’m glad you got it working :slight_smile:

By the way, I hope you don’t mind this too much, but the word is “pored” :slight_smile:

I had the exact same problem with my android apps crashing with no errors during local dev. The solution that worked for me was:

  1. adding this to the plugins section in the app.json:
"plugins": [
      [ "expo-updates",
        { "username": "<your expo username>" }
      ]
   ],
  1. running in the cli: eas update:configure
    This should write to both your app.json and eas.json.

If you run into the crashing again I recommend giving that a try.