question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App Crash in Release Build --- FATAL EXCEPTION: create_react_context

See original GitHub issue

Description

I can build in debug mode, it works fine, but when I get release build, it gets build, but the application breaks, you can see the error output here.

React Native version:

“react-native”: “0.62.2”,

##Error

Name
FATAL EXCEPTION: create_react_context
Reason
java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
Stacktrace
FATAL EXCEPTION: create_react_context
Process: com.seeandsign.papilon, PID: 27990
java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(Unknown Source:2)
at com.facebook.react.bridge.JSBundleLoader$1.loadScript(Unknown Source:10)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(Unknown Source:18)
at com.facebook.react.q.q(Unknown Source:180)
at com.facebook.react.q.b(Unknown Source:0)
at com.facebook.react.q$e.run(Unknown Source:68)
at java.lang.Thread.run(Thread.java:764)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:18

github_iconTop GitHub Comments

13reactions
Aure77commented, Jan 25, 2021

@grkemtneri This is not a good solution, you are generating code (index.android.bundle) inside source folder (android/app/src/) during build phase…

react.gradle tasks will generate it in build folder (build/generated/assets/react/…). But like @rahulson says, with latest version of com.android.tools.build:gradle, index.android.bundle is not copied inside APK. I downgraded to 'com.android.tools.build:gradle:4.0.2' & it’s works too.

11reactions
rahulsoncommented, Jan 20, 2021

@grkemtneri I faced same issue so I changed gradle plugin version in project gradle from 4.1.1 to 4.0.1 Then clean, rebuild and generate apk and now it is working fine

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native crash release build - FATAL EXCEPTION
(Android) I created a new project (v0.68.2), I didn't make any changes, the room crashed in the same way. npx react-native run-android --variant ......
Read more >
[Solved]-React Native crash release build - FATAL EXCEPTION
Coding example for the question React Native crash release build - FATAL EXCEPTION: create_react_context-React Native.
Read more >
Fixing React-Native android release build - wesionaryTEAM
Android release build crashes on launch but works fine in development mode. After months of research and development, your app is finally ready...
Read more >
Customize your Firebase Crashlytics crash reports - Google
Crashlytics provides four logging mechanisms out of the box: custom keys, ... your app's crashes, Crashlytics lets you record non-fatal exceptions and sends ......
Read more >
View crashes and application not responding (ANR) errors
Using Play Console, you can view data for crashes and application not ... if an issue was found while testing your app to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found