Skip to content

[Android] App crash on release build with gradle:3.4.0 / gradle-wrapper:5.1.1 (debug is working) #24861

Closed
@albat

Description

@albat

Hi,

I have an issue when launching an Android app with a release build (or a non-debug build) when using gradle:3.4.0 plugin and gradle-5.1.1 wrapper
The app crash directly after launch and I can see the following error in the logcat tab of Android Studio :
2019-05-15 11:16:39.412 31945-31961/? E/AndroidRuntime: FATAL EXCEPTION: create_react_context Process: com.testproject, PID: 31945 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:218) at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:31) at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:247) at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1152) at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:123) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:943) at java.lang.Thread.run(Thread.java:764)

The issue only happen with this version of Gradle plugin/wrapper and in release build.
If you do a debug build with the metro bundler started on your computer, it's working fine.
With the previous version (gradle plugin 3.1.1, gradle wrapper 4.10.2) it's working fine (debug and release).

I tested with
implementation "com.facebook.react:react-native:+"
and
implementation ("com.facebook.react:react-native:0.59.8"){force=true}
and it doesn't change anything

The issue happens on emulator and real devices.

React Native version: 0.59.8 (but also with previous version (tested with 0.58.6))
Gradle plugin version: 3.4.0
Gradle wrapper version: 5.1.1

Steps To Reproduce

  1. react-native init TestProject --version 0.59.8
  2. do a release build and install it on a device (emulator or not) and notice that it is working fine
  3. dump gradle plugin from 3.3.1 to 3.4.0 and gradle wrapper from 4.10.2 to 5.1.1
  4. do a release build and install it on a device (emulator or not) and notice that it is crashing

If you need something else or more tests, just let me know

Thanks in advance for your support

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions