Home > Software engineering >  Expo EAS build crash and disappear after successful install Android React Native
Expo EAS build crash and disappear after successful install Android React Native

Time:12-04

My expo application works normally on Expo go, even using the command bellow it still works.

npx expo start --no-dev --minify

But when building with different methods it don't work at all, with different crashes.

eas build -p android --profile preview

It generates the APK, when i drag to the emulator (android 11) it gets the "successful install", so I open and the splash screen shows, after that it crashes and the app disappear from the device. Looks like it was automatically uninstalled, because I can't find it anywhere in the files.

expo build:android -t apk

With the deprecated method above i still get a "successful install", but it never gets to the splash screen, just get a white screen and it never crashes or disappear from device.

I tried on multiple devices and android versions and i have the same problem with each build in all of them. So i guess the problem is the build. I couldn't find anyone else with the solution or a hint for it.

I tried uninstalling multiple npm packages to see if was the problem with no successes.

Its my first time working with React Native and Expo, so I can be missing something.

    //app.json
{
  "expo": {
    "name": "tv_box",
    "slug": "tv_box",
    "version": "1.0.0",
    "orientation": "landscape",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "package": "com.test.tv_box"
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "extra": {
      "eas": {
        "projectId": "4b9e5710-cdd0-4e3a-846d-3faed6c56510"
      }
    }
  }
}

//eas.json
{
  "cli": {
    "version": ">= 2.8.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}


//package.json
{
  "name": "tv_box",
  "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"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.17.10",
    "@react-navigation/stack": "^6.3.2",
    "expo": "~46.0.7",
    "expo-status-bar": "~1.4.0",
    "expo-system-ui": "~1.3.0",
    "expo-updates": "~0.14.7",
    "pocketbase": "^0.7.4",
    "react": "18.0.0",
    "react-native": "0.69.6",
    "react-native-gesture-handler": "~2.5.0",
    "react-native-restart": "^0.0.24",
    "react-native-vector-icons": "^9.2.0",
    "expo-av": "~12.0.4"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

CodePudding user response:

It's disappears in most of cases due to release build. In debug build you had to get normal error screen ( red ), add

"developmentClient": true

in your eas.json -> development block and try again.

CodePudding user response:

Solved with

npm i react-native-screens

And make sure you have everything updated in the latest version to build with EAS including the Expo SDK, React Native, expo and eas CLI.

  • Related