There is no problem in the development environment, but when I get the release build, the app crashes. (Android) I created a new project (v0.68.2), I didn't make any changes, the room crashed in the same way.
npx react-native run-android --variant=release
FATAL EXCEPTION: create_react_context
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.testreleasebuild, PID: 8291
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:1422)
at com.facebook.react.ReactInstanceManager.access$1200(ReactInstanceManager.java:138)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1111)
at java.lang.Thread.run(Thread.java:923)
For my case, after upgrade my react-native project from version 0.69.x to 0.70.x. The Android debug build should work but release build got same issue. Change to use Android Gradle plugin 7.2.2 help me resolved this.
android/build.gradle
classpath 'com.android.tools.build:gradle:7.2.2'
The Android Gradle Plugin version was 7.0.4 when the project was first created. Android Studio version asked me to upgrade to 7.2.1, so I upgraded. It worked when I downgraded the version to 7.0.4.
android>build.gradle
classpath('com.android.tools.build:gradle:7.0.4')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With