Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
albat opened this issue May 15, 2019 · 4 comments
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@albat
Copy link

albat commented May 15, 2019

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

@albat albat added the Bug label May 15, 2019
@react-native-bot react-native-bot added the Platform: Android Android applications. label May 15, 2019
@kelset
Copy link
Collaborator

kelset commented May 15, 2019

Hello there 👋

I think that the core of the issue lays here

dump gradle plugin from 3.3.1 to 3.4.0 and gradle wrapper from 4.10.2 to 5.1.1

I am pretty sure that react native can't use Gradle 5 for now - have you seen somewhere in the changelog mentioning that is supported (I may be wrong)?

Do you have any precise reasons for needing to use Gradle 5?

@kelset
Copy link
Collaborator

kelset commented May 15, 2019

Also, it seems that it's probably the same issue described here: #24854 so it seems to be related also to 3.4.0?

I'm closing this in favour of that other issue, but I'll ping internally if we are aware of these incompatibilities

@kelset kelset closed this as completed May 15, 2019
@albat
Copy link
Author

albat commented May 15, 2019

Do you have any precise reasons for needing to use Gradle 5?

It's the latest available version and Android Studio ask me to update my project so I tried ;-)

But indeed I haven't seen that we can use this version of Gradle yet.

Thanks for the reply

@curtismenmuir
Copy link

Seen same issue with RN 0.59.2. Android Studio upgraded gradle to version 5:

classpath 'com.android.tools.build:gradle:3.3.2' (/android/build.gradle)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip (gradle-wrapper.properties)

to

classpath 'com.android.tools.build:gradle:3.4.0'
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

Reverting these changes fixed the issue for me! Thanks for the help!

dn-l pushed a commit to dashevo/dashpay-wallet-OLD that referenced this issue Aug 7, 2019
dn-l pushed a commit to dashevo/dashpay-wallet-OLD that referenced this issue Aug 7, 2019
dn-l pushed a commit to dashevo/dashpay-wallet-OLD that referenced this issue Aug 7, 2019
@facebook facebook locked as resolved and limited conversation to collaborators May 15, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label May 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants