expo / eas-cli

Fastest way to build, submit, and update iOS and Android apps
https://docs.expo.dev/eas/
MIT License
728 stars 79 forks source link

[Android] Production build - java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release. #1088

Closed hkaras19 closed 2 years ago

hkaras19 commented 2 years ago

Build/Submit details page URL

https://expo.dev/accounts/hkaras19/projects/pvj/builds/6c5584a1-d559-493a-93b3-3a816507a5df

Summary

I am running into an error while testing my android production build on Firebase Test Lab. My app builds without errors on eas through the production profile. However, upon uploading this build file to Firebase Test Lab, the tests fail and indicate that the crash was due to Metro not running. Since this is a production build, the app bundle should not depend on a Metro server. My eas.json file is summarized below.

Note: this same error occurs on the Google Play store, as Google Play uses Firebase Test Lab for pre-screening.

{ "cli": { "version": ">= 0.46.0" }, "build": { "development": { "distribution": "internal", "android": { "gradleCommand": ":app:assembleDebug" }, "ios": { "buildConfiguration": "Debug", "cocoapods": "1.11.2" } }, "preview": { "distribution": "internal", "ios": { "simulator": true, "cocoapods": "1.11.2" }, "android": { "buildType": "apk", "image": "latest" } }, "production": { "ios": { "image": "latest" }, "android": { "image": "latest" } } }, "submit": { "production": {} } }

Managed or bare?

Bare

Environment

expo-env-info 1.0.3 environment info: System: OS: macOS 11.6 Shell: 5.8 - /bin/zsh Binaries: Node: 16.14.2 - /usr/local/opt/node@16/bin/node Yarn: 1.22.18 - /usr/local/bin/yarn npm: 8.5.0 - /usr/local/opt/node@16/bin/npm Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8193401 Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild npmPackages: expo: ^44.0.6 => 44.0.6 react: 17.0.2 => 17.0.2 react-native: 0.67.2 => 0.67.2 npmGlobalPackages: eas-cli: 0.48.2 expo-cli: 5.3.0 Expo Workflow: bare

Error output

java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release. FATAL EXCEPTION: create_react_context Process: com.hk808.pvj, PID: 23134 java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release. at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method) at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:248) at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:29) at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:277) at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1408) at com.facebook.react.ReactInstanceManager.access$1200(ReactInstanceManager.java:138) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1104) at java.lang.Thread.run(Thread.java:923)

Reproducible demo or steps to reproduce from a blank project

Step 1: eas build -p android Step 2: download the .aab file Step 3: upload the build to Firebase Test Lab / Google Play

wkozyra95 commented 2 years ago

For bare projects we are just running gradle build, there is nothing special in the process. If the js bundle is missing it's an issue with your project configuration and not with eas.

Does it work if you build a release APK and install it on the device?

dsokal commented 2 years ago

Closing because of the inactivity.

BerkeAras commented 1 year ago