From c784ea8b4029c4768f7e4194a4b4ef6980707d88 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Wed, 22 Apr 2026 02:03:38 -0700 Subject: [PATCH] Use Hermes V1 by default (#56476) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: The recent introduction of the `IRuntime` JSI interface moved `ScopeState` from `Runtime` to `IRuntime`, changing the C++ ABI (mangled symbol names). The Android build was still consuming a legacy Hermes nightly (`hermes-compiler@nightly`) that was built against the old JSI headers, causing an `UnsatisfiedLinkError` crash at startup: ``` dlopen failed: cannot locate symbol "_ZN8facebook3jsi7Runtime8popScopeEPNS1_10ScopeStateE" referenced by "libhermesvm.so" ``` This PR aligns Android with how iOS already handles Hermes V1: 1. **`scripts/try-set-nightly-hermes-compiler.js`** — The `yarn install` preinstall hook now installs `hermes-compiler@latest-v1` instead of `hermes-compiler@nightly`. This is the same npm dist-tag that iOS uses in `scripts/ios-prebuild/hermes.js`. 2. **`build.gradle.kts`** — When `hermesV1Enabled=true`, the Hermes version from `package.json` is used as-is (no `-SNAPSHOT` suffix), since V1 stable releases are published as regular Maven artifacts, not snapshots. 3. **`version.properties`** — Bumps `HERMES_V1_VERSION_NAME` from `250829098.0.11` to `250829098.0.12` for release builds and iOS podspec. ## Changelog: [ANDROID] [FIXED] - Use Hermes V1 stable release instead of legacy nightly to fix startup crash caused by JSI ABI mismatch Test Plan: - Run `yarn install` from the repo root and verify `hermes-compiler` in `packages/react-native/package.json` is set to the `latest-v1` version (currently `250829098.0.12`) - Run `yarn android` from `packages/rn-tester` and verify the app launches without crashing - Verify CI `build_android` job passes Reviewed By: javache Differential Revision: D101247487 Pulled By: cipolleschi --- build.gradle.kts | 10 +++++++++- .../react-native/sdks/hermes-engine/version.properties | 2 +- scripts/try-set-nightly-hermes-compiler.js | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 65cec5f60c40..0858b5cb2917 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -137,7 +137,15 @@ if (project.findProperty("react.internal.useHermesStable")?.toString()?.toBoolea ) } - hermesSubstitution = "$hermesCompilerVersion-SNAPSHOT" to "Users opted to use hermes nightly" + val hermesV1Enabled = project.findProperty("hermesV1Enabled")?.toString()?.toBoolean() ?: true + // Hermes V1 stable releases are published without the -SNAPSHOT suffix. + // Legacy nightly builds use -SNAPSHOT. + val resolvedVersion = + if (hermesV1Enabled) hermesCompilerVersion else "$hermesCompilerVersion-SNAPSHOT" + val reason = + if (hermesV1Enabled) "Users opted to use hermes V1 stable" + else "Users opted to use hermes nightly" + hermesSubstitution = resolvedVersion to reason } else { logger.warn( """ diff --git a/packages/react-native/sdks/hermes-engine/version.properties b/packages/react-native/sdks/hermes-engine/version.properties index 4e24a29fd47d..e5d8f2e9a530 100644 --- a/packages/react-native/sdks/hermes-engine/version.properties +++ b/packages/react-native/sdks/hermes-engine/version.properties @@ -1,2 +1,2 @@ HERMES_VERSION_NAME=1000.0.0 -HERMES_V1_VERSION_NAME=250829098.0.11 +HERMES_V1_VERSION_NAME=250829098.0.12 diff --git a/scripts/try-set-nightly-hermes-compiler.js b/scripts/try-set-nightly-hermes-compiler.js index ef931e4a6b9b..6b3edd0c9415 100644 --- a/scripts/try-set-nightly-hermes-compiler.js +++ b/scripts/try-set-nightly-hermes-compiler.js @@ -16,10 +16,10 @@ function main() { const hermesCompilerVersion = packageJson.dependencies['hermes-compiler']; if (hermesCompilerVersion === '0.0.0') { - console.log(`Hermes compiler version not set. Updating to the latest nightly release.`); - execSync('yarn workspace react-native add hermes-compiler@nightly --exact', { stdio: 'inherit' }); + console.log(`Hermes compiler version not set. Updating to the latest-v1 release.`); + execSync('yarn workspace react-native add hermes-compiler@latest-v1 --exact', { stdio: 'inherit' }); } else { - console.log(`Hermes compiler version set to ${hermesCompilerVersion}. Not setting nightly hermes.`); + console.log(`Hermes compiler version set to ${hermesCompilerVersion}. Not setting hermes.`); } }