hermes: RN 0.63.0 + enableHermes -> crash on start

Bug Description

Got this failure after switching to RN 0.63.0 and enabling Hermes (following https://reactnative.dev/docs/hermes):

image

Hermes version: ? React Native version: 0.63.0 Android version: Android 10 Device: Samsung galaxy s20

From logcat:

2020-07-16 11:23:30.983 6540-6704/com.evernote E/unknown:ReactNative: ReactInstanceManager.createReactContext: mJSIModulePackage not null
2020-07-16 11:23:30.984 6540-6704/com.evernote E/unknown:ReactNative: ReactInstanceManager.createReactContext: ReactFeatureFlags.useTurboModules == false
2020-07-16 11:23:30.991 6540-6719/com.evernote E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance()
2020-07-16 11:23:31.040 6540-6719/com.evernote E/Evernote cache: loaded webconfiguration
2020-07-16 11:23:31.044 6540-6719/com.evernote E/Evernote cache: loaded webconfiguration
2020-07-16 11:23:31.124 6540-6719/com.evernote E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication
2020-07-16 11:23:31.131 1199-2381/? E/WifiService: 10348 has no permission about LOCAL_MAC_ADDRESS
2020-07-16 11:23:31.480 6540-6718/com.evernote E/unknown:ReactNative: CatalystInstanceImpl caught native exception
    com.facebook.jni.UnknownCppException: Unknown
        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:27)
        at android.os.Looper.loop(Looper.java:237)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:919)
2020-07-16 11:23:31.481 6540-6718/com.evernote E/unknown:ReactNative: Exception in native call
    com.facebook.jni.UnknownCppException: Unknown
        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:27)
        at android.os.Looper.loop(Looper.java:237)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:919)
2020-07-16 11:23:31.486 6540-6718/com.evernote E/ReactNativeJNI: Attempting to call JS function on a bad application bundle: HMRClient.setup()
2020-07-16 11:23:31.488 6540-6718/com.evernote E/unknown:ReactNative: CatalystInstanceImpl caught native exception
    java.lang.RuntimeException: Attempting to call JS function on a bad application bundle: HMRClient.setup()
........

2020-07-16 11:23:31.488 6540-6718/com.evernote E/unknown:ReactNative: Exception in native call
    java.lang.RuntimeException: Attempting to call JS function on a bad application bundle: HMRClient.setup()
........

2020-07-16 11:23:31.489 6540-6718/com.evernote E/ReactNativeJNI: Attempting to call JS function on a bad application bundle: AppRegistry.runApplication()
2020-07-16 11:23:31.490 6540-6718/com.evernote E/unknown:ReactNative: CatalystInstanceImpl caught native exception
    java.lang.RuntimeException: Attempting to call JS function on a bad application bundle: AppRegistry.runApplication()
........

2020-07-16 11:23:31.490 6540-6718/com.evernote E/unknown:ReactNative: Exception in native call
    java.lang.RuntimeException: Attempting to call JS function on a bad application bundle: AppRegistry.runApplication()
........

2020-07-16 11:23:31.490 6540-6718/com.evernote E/ReactNativeJNI: Attempting to call JS function on a bad application bundle: RCTDeviceEventEmitter.emit()
2020-07-16 11:23:31.492 6540-6718/com.evernote E/unknown:ReactNative: CatalystInstanceImpl caught native exception
    java.lang.RuntimeException: Attempting to call JS function on a bad application bundle: RCTDeviceEventEmitter.emit()
........

2020-07-16 11:23:31.492 6540-6718/com.evernote E/unknown:ReactNative: Exception in native call
    java.lang.RuntimeException: Attempting to call JS function on a bad application bundle: RCTDeviceEventEmitter.emit()
........

Please help. Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 9
  • Comments: 33 (9 by maintainers)

Most upvoted comments

You can force to use v0.5.1 of hermes:

1- "hermes-engine": "0.5.1", - in your package.json in the dev dependencies 2- yarn install 3- yarn start --reset-cache

that’s works for me , i’m currently using the version 0.63.2

if you upgrade hermes, you need to change the hermesCommand to use hermesc instead hermes :

project.ext.react = [
        ....hermesOptions
        enableHermes : true,       
        hermesCommand: "../../node_modules/hermes-engine/%OS-BIN%/hermesc",
]

One thing to note @Eli-Nathan, you do need to do a gradlew clean when updating hermes engine to “hermes-engine”: “0.5.1”. yarn start --reset-cache is not enough.

Updating to 0.5.1 did fix things for me.

cd ./android
sh ./gradlew clean

@alexkrav Hi. I was experiencing similar error when upgrading from 0.62.2 to 0.63.1. In my case the issue was that I had undefined values in StyleSheet

const styles = StyleSheet.create({
	x: undefined
});

The error was coming from react-native/Libraries/StyleSheetValidation.js validateStyle (line 50), which is parsing your StyleSheets in dev mode. The problem in my codebase was that I was using Platform.select(…) inside Stylesheet without specifying android config, which was returning undefined and causing validation error. Also disabling hermes gave me a better stacktrace to spot the issue.

I also noticed error line shown before above exceptions:

2020-07-16 14:24:03.927 6037-6037/? E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found result: 0