Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server. App crash in release build only
See original GitHub issue- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Environment
Done in 2.05s. - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
Android SDK:
Build Tools: 23.0.1, 23.0.2, 23.0.3, 24.0.2, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 27.0.3, 28.0.0, 28.0.2, 28.0.3
API Levels: 22, 23, 24, 25, 26, 27, 28
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.1 => 0.57.1
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
Description
I get the error below on release builds. I don’t see the issue in my dev environment i.e. react-native run-android
. I installed the apk on my Pixle 2 XL - Android Pi and the app immediately crashes. I got the error below from my Firebase console (Crashlytics)
Fatal Exception: java.lang.RuntimeException: Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.
at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(CatalystInstanceImpl.java)
at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:216)
at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:32)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:243)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1114)
at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:116)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:913)
at java.lang.Thread.run(Thread.java:764)
Reproducible Demo
Let us know how to reproduce the issue. Include a code sample, share a project, or share an app that reproduces the issue using https://snack.expo.io/. Please follow the guidelines for providing a MCVE: https://stackoverflow.com/help/mcve
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:23 (4 by maintainers)
Top Results From Across the Web
Unable to load script from assets 'index.android.bundle'. Make ...
Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.
Read more >React Native: Unable to load script: index. android.bundle
Step 1: I am using React Native version 0.63.2 like below, and I want to build an android app by using Fastlane for...
Read more >Fixing React-Native android release build - wesionaryTEAM
Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
Read more >Build and test your Android App Bundle
Deploy using app bundles with Android Studio · Select Run > Edit Configurations from the menu bar. · Select a run/debug configuration from...
Read more >What does the error message 'Unable to load script ... - Quora
Make sure you are either running a Metro server or that your bundle 'index.Android.bundle' is packaged correctly for release" mean in React Native...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For me this combination worked using
"react-native": "0.59.4"
gradle-wrapper.properties
adddistributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
build.gradle
useclasspath 'com.android.tools.build:gradle:3.3.0'
build.gradle
I have:right above
apply from: "../../node_modules/react-native/react.gradle"
For some reason I had
import com.facebook.react.BuildConfig;
in my MainAplication file (I guess due to some smart ass auto import fixing feature of IntelliJ), and thereforeBuildConfig.DEBUG
was set to false. Because of this:React Native was always trying to load index.android.bundle from the app pacakge, not from the dev server. Removing the
import com.facebook.react.BuildConfig
line fixed the issue for me 🎆 🍺 👍