E/unknown:React: Exception in native call
Asked Answered
N

4

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)
Nobility answered 20/1, 2018 at 4:42 Comment(1)
Can you please share your JS codeEma
D
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.

Dodona answered 9/5, 2019 at 7:3 Comment(0)
A
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
Asuncion answered 20/1, 2018 at 5:16 Comment(1)
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.Cupcake
D
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.

Dodona answered 9/5, 2019 at 7:3 Comment(0)
M
0

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

Martell answered 18/3, 2021 at 19:35 Comment(0)
W
0

In addition to Rajat Soni's answer you need to create android/app/src/main/assets/index.android.bundle if it doesn't already exist.

Wallop answered 22/12, 2023 at 10:36 Comment(1)
Welcome to SO! Try to improve the formatting of your answer: do use punctuation, use CTRL-K to display code , maybe some boldBouncy

© 2022 - 2025 — McMap. All rights reserved.