upgrade-support icon indicating copy to clipboard operation
upgrade-support copied to clipboard

Android insta-crash in RN 0.62.2 with hermes enabled

Open southerneer opened this issue 5 years ago • 6 comments
trafficstars

Environment

System:
    OS: macOS 10.15.5
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Memory: 71.72 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.17.0 - ~/.nvm/versions/node/v12.17.0/bin/node
    Yarn: 1.22.4 - ~/.yarn/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v12.17.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2, 29.0.3
      System Images: android-28 | Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6514223
    Xcode: 11.5/11E608c - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_252 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0
    react-native: 0.62.2 => 0.62.2
  npmGlobalPackages:
    *react-native*: Not Found

Upgrading version

0.61.5 ... to 0.62.2

Description

Android successfully builds in release mode with enableHermes set to true but then crashes instantly on startup with the error message:

com.facebook.jni.CppException: Could not get BatchedBridge, make sure your bundle is packaged correctly
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:1)
        at android.os.Looper.loop(Looper.java:214)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:8)
        at java.lang.Thread.run(Thread.java:919)

We currently have hermes activated with RN 0.61.5 and we can't simply turn that option off in order to upgrade. Some things I've tried without success:

  • run .gradlew clean before building
  • specifying a specific soloader version via these instructions: https://github.com/facebook/react-native/issues/25923#issuecomment-594047945
  • update the app to use the latest RN 0.63 release candidate (rc-1 as of writing)
  • turn off proguard
  • use latest build tools configs...
buildToolsVersion = "28.0.3"
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 28

Reproducible demo

It's a private github repo and I can't share the source code, but if I can manage to reproduce it separately I'll put it up here.

southerneer avatar Jul 07 '20 22:07 southerneer

Does adding the code in this commit fix the issue https://github.com/facebook/react-native/commit/449dc37720b24d9d88661314424c9f982e70ec3a
See https://github.com/facebook/react-native/issues/28270

Maskedman99 avatar Jul 08 '20 19:07 Maskedman99

Unfortunately no. That change came along with the upgrade via the upgrade helper and it didn't help with this problem.

southerneer avatar Jul 09 '20 01:07 southerneer

I just tested to enable hermes in my 0.63.0 project, and experienced the same issue in release build

exneval avatar Jul 13 '20 08:07 exneval

I am having a similar issue. After upgrading my app from 0.61.5 to 0.63.0 using the upgrade helper, I am getting an instant crash on Android that only happens if I have hermes enabled. I am seeing a red screen with an "Unknown" error, and no useful information in the logs Screen Shot 2020-07-15 at 11 08 52 AM

laurenwilliams avatar Jul 15 '20 18:07 laurenwilliams

We just tried again with an upgrade to 0.63.2 and the same result. com.facebook.jni.CppException: Could not get BatchedBridge, make sure your bundle is packaged correctly

southerneer avatar Sep 24 '20 19:09 southerneer

Related: https://github.com/facebook/react-native/issues/26930#issuecomment-591673281

a613 avatar Sep 24 '20 20:09 a613