3

I am trying to run my react native app (android version) in release mode on emulator. I am running it from android studio.

Suddenly I have started getting this error

FATAL EXCEPTION: Thread-3 Process: com.cgi.oslomelding.foresatte, PID: 7057 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(Native Method) at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:216) at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:33) at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:234) at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1113) at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:113) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:920) at java.lang.Thread.run(Thread.java:764)

It seems like the bundle is not working properly. Any thoughts on how to overcome this?

My react-native version is 0.53.3 My gradle version is 4.10.1 My android plugin version is 3.3.0

mohsinali1317
  • 4,255
  • 9
  • 46
  • 85

1 Answers1

6

Run the following:

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

and then

react-native run-android --variant=release
Daniel Danaee
  • 280
  • 1
  • 8
  • Thank you so much! Tried solving this by adding all kinds of abiFilters etc after seeing soloader related errors. None of them were needed after running your command. Thanks for sharing! – riper May 23 '19 at 13:28
  • No worries. You got it ;) – Daniel Danaee May 24 '19 at 14:48
  • u save my life, but I did make some changes according to another post, https://stackoverflow.com/a/50834600/3230406 and then follow your command to rebuild the bundle – V-SHY Jul 31 '19 at 09:20
  • Please select it as an Answer if it worked out for you. Thank you :) – Daniel Danaee Jul 31 '19 at 11:00
  • For what it's worth, we ran into this on 0.70.0... no idea if it is a regression or something, but default react building wasnt bundling any JS assets – fullStackChris Nov 02 '22 at 11:38