Skip to content

hermesCommand in 'Migrating to Expo modules' broken for React Native 0.69.x #86

Open
@cameronmurphy

Description

@cameronmurphy

When upgrading to Expo 46 and React Native 0.69.5 the hermesCommand in android/app/build.gradle file broke our Android build. This hermesCommand is in the Migrating to Expo Modules doc.

This issue was masked by expo-updates complaining about 'No launchable update was found', so the app would crash on launch. When I removed expo-updates from the project it was instead throwing the error com.facebook.jni.CppException: Compiling JS failed: Wrong bytecode version. Expected 85 but got 84.

Now that I was able to find this issue, I found this related issue and was able to fix it:
facebook/react-native#34114

This happened because the Bare Workflow upgrade notes say to "Apply any relevant changes from the React Native Upgrade Helper" however the stock React Native android/app/build.gradle file does not override the hermesCommand, only Expo's version of android/app/build.gradle does.

Perhaps some kind of 'Expo Upgrade Helper' would be useful, to make it obvious how the supporting files should change, so tweaks like this one don't get missed. It's cumbersome to create fresh projects using create-expo-app and compare the files manually.

Instead of

hermesCommand: new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/%OS-BIN%/hermesc",

it should be

hermesCommand: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc",

This is what's now in android/app/build.gradle when you run npx create-expo-app -t bare-minimum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions