Failed to load script from index.android.bundle. Make sure your package is packaged correctly or you are using a packer server

I have a React Native application working with version 0.38.0, when I tried to upgrade it to 0.45.1, it shows the following error

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.cxxbridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method) at com.facebook.react.cxxbridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:198) at com.facebook.react.cxxbridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:33) at com.facebook.react.cxxbridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:216) at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:994) at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109) at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:746) at java.lang.Thread.run(Thread.java:761) 

I tried the following solutions, but for me it did not work

SO: unable to load script from index.android.bundle assets in windows
SO: edit native android failed to load js package

+4
source share
1 answer

1- Create a new folder => android/app/src/main/assets
2- Run this command =>

  react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res 

This command will create 2 files: index.android.bundle and index.android.bundle.meta

3- run command => react-native run-android

+17
source

Source: https://habr.com/ru/post/1269019/


All Articles