-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 #22076
Comments
Can you run If you believe this information is irrelevant to the reported issue, you may write |
What command did you use to make the release build? Can you post an (anonimized) copy of your android/app/build.gradle ? The (default) debug build retrieves the js bundle from the packager at runtime. A release build needs a local version of the bundle in the binary. Your error indicates that this local bundle is not present in the APK. This can be caused by a misconfigured app/build.gradle, such as pointing to the wrong bundle name or not packaging during the release process all. |
Did you happen to upgrade gradle version? I got the same issue when I upgraded:
from
and
from
|
I have same issue when upgrade into latest version: -build:
This issue only have in release build. Debug mode is not. |
I have the same problem when running an app in emulator, downgraded gradle to 3.1.4 but it didn't work.
My packaging server is running on port 8081 (via Isn't react-native supposed to run the command to build the bundle file automatically? I can't run it manually on every change, it's insane (in particular because the command runs extremely slow).
In Android Studio the Build Variant option is set to debug for all modules. Update: I found a way to automatically run the bundle script: add this to your app/build.grandle:
Apparently the But this is still not a solution... ideally the app should connect to the packager server running on localhost, but for at least it doesn't do that, sadly I haven't figured out why 😞 Update 2: |
For some reason I had
React Native was always trying to load index.android.bundle from the app pacakge, not from the dev server. Removing the |
I am closing this issue because it does not contain the necessary environment info, and there has been no followup in a while. If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here. |
This worked for me: In Add:
Above the line:
|
I had this issue only on Mac OS and only while trying to build for Android. It started to happen after my update from RN 0.57 to 0.59. To understand what is going on I started a new RN project and compared differences with my project. I noticed that there is a new folder in the new project - android/app/src/debug. And there is only one file in this folder - AndroidManifest.xml with the following contents:
After adding this file to my old project Metro Bundler started working for Android as expected. |
For me this combination worked using
right above |
Thank you @vinnyhoward ! That worked perfectly for me. |
Seriously @vinnyhoward Thank you! My release apk has been broken for days and I have been trying everything to get it to include the bundle. Android Studio "strongly recommends" upgrading gradle to 5.1.1 and it looks like that was my problem after all. Cheers! 🍻 |
It turned out to be a problem of Use 3.3.* instead of 3.4.* works for me:
I still use gradle 5.4.1. This does not cause the problem, though. |
@vinnyhoward answer works for me. |
@vinnyhoward solution works for me! Thanks |
@vinnyhoward solution works for me as well. |
@vinnyhoward That worked for me too. |
@deserthurricane This worked for me, also going from ~57 to 59. I missed this step in my diff upgrade! |
When I change gradle to |
For my project using react-native So it builds with js bundle in assets after I changed the
you can replace the new asset dir with the one your gradle plugin uses if it is not the same(for me it is
|
This worked for me :) |
Environment
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)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
The text was updated successfully, but these errors were encountered: