Enabling hermes, crashes expo development build instantly.

See original GitHub issue

Summary

I’m trying to enable the hermes on my app. I followed expo using hermes instructions to enable hermes. But when i change the expo.jsEngine=jsc to expo.jsEngine=hermes in build.properties and build the app it crashes instantly with below error.

ss 2

Managed or bare workflow? If you have made manual changes inside of the ios/ or android/ directories in your project, the answer is bare!

bare

What platform(s) does this occur on?

Android

Package versions

“dependencies”: { “@ampproject/remapping”: “^2.2.0”, “@expo/config-plugins”: “^4.1.0”, “@expo/prebuild-config”: “^4.0.0”, “@jridgewell/trace-mapping”: “^0.3.13”, “@react-native-community/netinfo”: “8.2.0”, “@react-native-google-signin/google-signin”: “^7.2.2”, “@react-navigation/drawer”: “^6.4.1”, “@react-navigation/native”: “^6.0.10”, “@react-navigation/native-stack”: “^6.6.2”, “@react-navigation/stack”: “^6.2.1”, “@robinbobin/react-native-google-drive-api-wrapper”: “^1.2.3”, “docx”: “^7.3.0”, “eas-cli”: “^0.54.1”, “expo”: “~45.0.0”, “expo-build-properties”: “~0.2.0”, “expo-cli”: “^5.5.1”, “expo-clipboard”: “~3.0.1”, “expo-dev-client”: “~1.0.1”, “expo-file-system”: “~14.0.0”, “expo-in-app-purchases”: “~13.0.0”, “expo-modules-autolinking”: “^0.8.1”, “expo-navigation-bar”: “~1.2.0”, “expo-permissions”: “^13.2.0”, “expo-splash-screen”: “~0.15.1”, “expo-system-ui”: “^1.2.0”, “formik”: “^2.2.9”, “global”: “^4.4.0”, “hermes-engine”: “^0.5.2-rc1”, “moti”: “^0.18.0”, “nanoid”: “^3.3.4”, “react”: “17.0.2”, “react-dom”: “17.0.2”, “react-native”: “0.68.2”, “react-native-actions-sheet”: “^0.6.1”, “react-native-appearance”: “^0.0.0”, “react-native-document-picker”: “^8.1.1”, “react-native-draggable-flatlist”: “^3.1.2”, “react-native-fs”: “^2.20.0”, “react-native-gesture-handler”: “~2.2.1”, “react-native-get-random-values”: “~1.8.0”, “react-native-google-drive-api-wrapper”: “^1.4.0”, “react-native-google-mobile-ads”: “^6.3.0”, “react-native-mmkv”: “^2.4.3”, “react-native-navigation-bar-color”: “^2.0.1”, “react-native-paper”: “^4.12.1”, “react-native-reanimated”: “~2.8.0”, “react-native-restart”: “^0.0.24”, “react-native-safe-area-context”: “4.2.4”, “react-native-screens”: “~3.11.1”, “react-native-select-dropdown”: “^2.0.0”, “react-native-svg”: “12.3.0”, “react-native-system-navigation-bar”: “^1.0.4”, “react-native-tags”: “^2.2.1”, “react-native-toast-notifications”: “^3.2.3”, “react-native-web”: “0.17.7”, “rn-fetch-blob”: “^0.12.0”, “xlsx”: “^0.18.5”, “yup”: “^0.32.11”

Environment

expo-env-info 1.0.4 environment info: System: OS: Windows 10 10.0.22000 Binaries: Node: 16.16.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD SDKs: Android SDK: API Levels: 28, 31 Build Tools: 30.0.2, 31.0.0, 33.0.0 System Images: android-31 | Google Play Intel x86 Atom_64 IDEs: Android Studio: AI-212.5712.43.2112.8609683 npmPackages: expo: ~45.0.0 => 45.0.6 react: 17.0.2 => 17.0.2 react-dom: 17.0.2 => 17.0.2 react-native: 0.68.2 => 0.68.2 react-native-web: 0.17.7 => 0.17.7 Expo Workflow: bare

Reproducible demo

app.json

  "expo": {
    "jsEngine": "hermes",
}

app/build.gradle

project.ext.react = [
    enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes",
]

...

def enableHermes = project.ext.react.get("enableHermes", false);

...

if (enableHermes) {
      debugImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim(), "../android/hermes-debug.aar"))
      releaseImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim(), "../android/hermes-release.aar"))
    } else {
      implementation jscFlavor
    }

...

gradle.properties

# The hosted JavaScript engine
# Supported values: expo.jsEngine = "hermes" | "jsc"
expo.jsEngine=hermes

Stacktrace (if a crash is involved)

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
BalogunofAfricacommented, Oct 9, 2022

I don’t know how expo handled hermes on SDK 46 for managed workflows. The above solution is for the bare workflows. You cannot change build.gradle file with managed workflow. Depends on the release notes in SDK 46, it uses Bundled Hermes now. Therefore the code above in app/build.gradle file needs to change.

 if (enableHermes) {
-       def hermesPath = "../../node_modules/hermes-engine/android/";
-       debugImplementation files(hermesPath + "hermes-debug.aar")
-       releaseImplementation files(hermesPath + "hermes-release.aar")

+      implementation("com.facebook.react:hermes-engine:+") {
+      exclude group:'com.facebook.fbjni'
    } else {
        implementation jscFlavor
    }

Like I said before, this solution is for the bare workflows.

I am having the same issue with bare expo app, release builds crash immediately and I have changed the implementation to use bundled hermes in build.gradle

0reactions
somaestrategiascommented, Oct 14, 2022

For anyone still having issues, none of the above solutions worked for me. This was a long shot but it worked.

1 - remove packaging options from “expo-build-properties” in your app.json expo plugins. 2 - run expo prebuild --clean 3 - cd into android and run ./gradlew 4- - run expo run:android

And it worked. Hope it helps anyone.

        "expo-build-properties",
        {
          "android": {
            "compileSdkVersion": 31,
            "targetSdkVersion": 31,
            "minSdkVersion": 24,
            "buildToolsVersion": "31.0.0",
            #REMOVE HERE
            "packagingOptions": {
              -"pickFirst": [
                -"lib/arm64-v8a/libc++_shared.so",
                -"lib/armeabi-v7a/libc++_shared.so",
                -"lib/x86/libc++_shared.so",
                -"lib/x86_64/libc++_shared.so"
              -]
            }
          #END OF REMOVE 
          },
          "ios": {
            "deploymentTarget": "13.0"
          }
        }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Expo 46, EAS, react-native-firebase and hermes
This only happens on EAS builds. It works fine locally, unfortunately, but internal or store builds crash on launch.
Read more >
Using Hermes - React Native
Edit your android/app/gradle.properties file and make sure hermesEnabled is true: # Use this property to enable or disable the Hermes JS engine.
Read more >
iOS Production build (EAS, Expo) crashes directly after ...
The problem was solved by enabling hermes in the Podfile with :hermes_enabled => true.
Read more >
React Native: Best Practices Part 2 - Coded Lines Ltd
The Expo team has to first develop and integrate RN updates for the ... React library has provided a new tool to address...
Read more >
Expo - Twitter
Develop, preview, submit, and update native apps from a single React codebase ... with an idiomatic Swift & Kotlin API - Hermes for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found