androidreact-native

React Native App crashing on release mode but working fine debug mode


My React native app was working fine few days back on both release and debug mode but from yesterday it keeps crashing on start in release mode, but it is working perfectly fine on debug mode. When i ran

adb logcat *:E

it gave me following logs but i can't find anything on internet related to this

02-17 18:30:56.108   564   595 E libPowerHal: Could not open '/proc/1705/comm'
02-17 18:30:56.108   564   595 E libPowerHal: error : 13, Permission denied
02-17 18:30:56.260 22398 22398 E com.blackhedge: Not starting debugger since process cannot load the jdwp agent.
02-17 18:30:56.282   564   595 E libPowerHal: perfLockRel handle:293
02-17 18:30:56.517 22398 22398 E libc    : Access denied finding property "ro.vendor.df.effect.conflict"
02-17 18:30:56.518   534 22445 E ResolverController: No valid NAT64 prefix (105, <unspecified>/0)
02-17 18:30:56.518   534 22447 E ResolverController: No valid NAT64 prefix (105, <unspecified>/0)
02-17 18:30:56.518   534 22446 E ResolverController: No valid NAT64 prefix (105, <unspecified>/0)
02-17 18:30:56.597   564   595 E libPowerHal: perfLockRel handle:294
02-17 18:30:56.716  1204  1687 E WindowManager: App trying to use insecure INPUT_FEATURE_NO_INPUT_CHANNEL flag. Ignoring
02-17 18:30:56.716   534 22467 E ResolverController: No valid NAT64 prefix (105, <unspecified>/0)
02-17 18:30:56.720 22398 22454 E AndroidRuntime: FATAL EXCEPTION: create_react_context
02-17 18:30:56.720 22398 22454 E AndroidRuntime: Process: com.blackhedge, PID: 22398
02-17 18:30:56.720 22398 22454 E AndroidRuntime: java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
02-17 18:30:56.720 22398 22454 E AndroidRuntime:        at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
02-17 18:30:56.720 22398 22454 E AndroidRuntime:        at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:239)
02-17 18:30:56.720 22398 22454 E AndroidRuntime:        at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:29)
02-17 18:30:56.720 22398 22454 E AndroidRuntime:        at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:268)
02-17 18:30:56.720 22398 22454 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1371)
02-17 18:30:56.720 22398 22454 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager.access$1100(ReactInstanceManager.java:136)
02-17 18:30:56.720 22398 22454 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1065)
02-17 18:30:56.720 22398 22454 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:919)
02-17 18:30:56.730 22398 22457 E fullstory: Destroy scanner called twice
02-17 18:30:56.809  1204  1329 E InputDispatcher: channel '81fad7a com.blackhedge/com.blackhedge.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
02-17 18:30:56.812  4731  4790 E PowerKeeper.Event: oops, parse AM_RESTART_ACTIVITY_AI parameter error
02-17 18:30:56.814  1204  1343 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.927) failed {.code = ERROR_NOT_SUPPORTED, .description = }
02-17 18:30:57.182  1705  1705 E Launcher: changeViewByFsGestureState,  view=ShortcutMenuLayer,  alpha=1.0,  scale=1.0
02-17 18:30:57.233   564   595 E libPowerHal: perfLockRel handle:295
02-17 18:30:59.825  1204  1343 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.927) failed {.code = ERROR_NOT_SUPPORTED, .description = }

I tried generating logs and searched on internet the errors i was getting on logs but found nothing


Solution

  • this error is caused by the absence of the index.android.bundle file in the ./android/app/src/main/assets directory

    First step:

    Create the assets folder if it does not exist in the android/app/src/main/ directory

    Second step:

    Run the following command line:

    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/
    

    Step three:

    Compile the application in release mode