'React Native crash after running Android DEBUG build: AndroidRuntime: FATAL EXCEPTION: create_react_context
Just got a new M1 MBP from work. The app builds successfully, however, the app crashes immediately on launch when building for debug. Release builds launch without an issue.
I've gone through every file in the Android folder and I've compared it to a new RN project of the same version. Can't seem to find anything that would cause the app to not launch. The stack trace from the crash is below.
Stack trace:
--------- beginning of crash
2022-02-09 14:31:27.093 12685-12719/com.myApp E/AndroidRuntime: FATAL EXCEPTION: create_react_context
Process: com.myApp, PID: 12685
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:239)
at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:29)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:268)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1371)
at com.facebook.react.ReactInstanceManager.access$1100(ReactInstanceManager.java:136)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1065)
at java.lang.Thread.run(Thread.java:920)
React Native Info
System:
OS: macOS 12.2
CPU: (10) arm64 Apple M1 Max
Memory: 5.28 GB / 64.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
Yarn: 1.22.15 - ~/.nvm/versions/node/v16.14.0/bin/yarn
npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
Watchman: 2022.02.07.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.2 - /opt/homebrew/lib/ruby/gems/3.1.0/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8139111
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.2 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.3 => 0.66.3
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
