Skip to content

fix: support RN 0.81.5 and below Hermes prefab target on Android#217

Merged
V3RON merged 3 commits into
mainfrom
fix/rn-081-hermes-target
Jul 7, 2026
Merged

fix: support RN 0.81.5 and below Hermes prefab target on Android#217
V3RON merged 3 commits into
mainfrom
fix/rn-081-hermes-target

Conversation

@V3RON

@V3RON V3RON commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What is this?

Fixes #216. Apps on React Native 0.81.x failed to configure Voltra's native Android module because packages/android-client/android/CMakeLists.txt hard-coded the RN >= 0.82 Hermes prefab target:

Target "voltra_js_renderer" links to target "hermes-engine::hermesvm" but the target was not found.

RN <= 0.81 publishes the Hermes prefab module as libhermes, exposed to CMake as hermes-engine::libhermes, while RN >= 0.82 uses hermes-engine::hermesvm. This PR makes Voltra support both target names.

The PR also keeps the 16KB page-size alignment fix for libvoltra_js_renderer.so, required for newer Android devices and Play Store submissions.

How does it work?

CMakeLists.txt now probes which Hermes prefab target find_package(hermes-engine) resolved. It links hermes-engine::hermesvm on RN >= 0.82 and hermes-engine::libhermes on RN <= 0.81. If neither target exists, CMake fails early with a Voltra-specific error instead of surfacing a confusing target-link failure later.

libvoltra_js_renderer.so is explicitly linked with -Wl,-z,max-page-size=16384, so the generated native library is 16KB-page-aligned regardless of the NDK version used by the host app. build.gradle also excludes both **/libhermes.so and **/libhermesvm.so, so Voltra does not bundle a duplicate Hermes runtime for either RN generation.

To validate the RN 0.81 path, I generated a fresh React Native CLI app in this repository at test-app-81 with React Native 0.81.0, wired Voltra through local file: dependencies, ran voltra apply --platform android --yes, and built :app:assembleDebug successfully. Then I swapped the same app to published Voltra 2.1.1; the build failed at :use-voltra_android-client:configureCMakeDebug[arm64-v8a] with the missing hermes-engine::hermesvm target. After restoring local file: dependencies, the app built successfully again.

Why is this useful?

This unblocks Voltra Android builds for RN 0.81.x apps, where published 2.1.1 currently fails before native compilation can complete.

It also keeps RN >= 0.82 behavior intact, makes 16KB page-size compliance explicit, and avoids duplicate Hermes .so packaging across both Hermes prefab generations.

V3RON added 3 commits July 7, 2026 10:30
RN <= 0.81 publishes the Hermes prefab module as `libhermes` (CMake
target hermes-engine::libhermes), while RN >= 0.82 renamed it to
`libhermesvm` (hermes-engine::hermesvm). CMakeLists.txt hard-coded the
0.82+ target name, so any app on RN 0.81.x failed to configure with
"target was not found". Branch on whichever target find_package
actually resolves.

Also explicitly pin libvoltra_js_renderer.so to 16KB page alignment
via -Wl,-z,max-page-size=16384 so older NDKs (< r28) still produce
16KB-compatible output, and exclude libhermesvm.so from packaging so
Voltra never bundles a duplicate Hermes engine on RN >= 0.82 hosts
(mirrors the existing libhermes.so exclude for RN <= 0.81).

Fixes #216
Document the user-facing Android build fix for React Native 0.81 apps.
@V3RON V3RON merged commit 5cc2189 into main Jul 7, 2026
13 checks passed
@V3RON V3RON deleted the fix/rn-081-hermes-target branch July 7, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for react native 0.81.5 and above

1 participant