2

I run android app via emulator, but got some error like below.

Don't know how to fix it.

Is there someone who know the solution?

please help.

thanks.

E/unknown:React: Exception in native call
                                                                            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:818)
Jiwon Kim
  • 139
  • 3
  • 12

3 Answers3

2

Possible Duplicate of this question. Try running this command from root directory of your project.

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
Rajat Soni
  • 600
  • 7
  • 10
  • it returns error ENOENT: no such file or directory, open 'android/app/src/main/assets/index.android.bundle'. Run CLI with --verbose flag for more details. – Umer Oct 07 '20 at 10:33
2

I encountered the same problem.

I resolve this, by deleting the dependency in android\settings.gradle file. That not specified in the build.gradle file.

This fix my problem. Hope this helps you.

Pradeep Kumar
  • 586
  • 3
  • 19
0

A source of the issue can be import com.facebook.react.BuildConfig; in MainApplication.java. Removing that may help.

atlascoder
  • 2,746
  • 3
  • 26
  • 34