Friday, 26 March 2021

Android Gradle Plugin issue: React Native app(just release) crashed when update AGP to 4.1.2

I have a React Native app, and it's built into Android app well with the help of android gradle plugin(AGP) version 3.5.2., react native version 0.61.5.

I faced a quite bizzar issue when upgrade AGP to 4.1.2: I can build both debug and release versions of application, debug version work well without any complaints but when I start release version I've got a crash with such kind of error

E/AndroidRuntime: FATAL EXCEPTION: create_react_context
Process: com.app.qa, PID: 21103
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(CatalystInstanceImpl.java:227)
    at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:28)
    at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:261)
    at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1175)
    at com.facebook.react.ReactInstanceManager.access$1000(ReactInstanceManager.java:125)
    at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:951)
    at java.lang.Thread.run(Thread.java:923)

So, with AGP 3.5.2 it's Ok, with AGP 4.1.2 I have some troubles with release bundle package.

Could it be fixed with the newest version of AGP or should I downgrade AGP? What changes should I make into build.gradle to fix it?



from Android Gradle Plugin issue: React Native app(just release) crashed when update AGP to 4.1.2

No comments:

Post a Comment