fix: support RN 0.81.5 and below Hermes prefab target on Android#217
Merged
Conversation
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
…unknown Hermes prefab target
Document the user-facing Android build fix for React Native 0.81 apps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.txthard-coded the RN >= 0.82 Hermes prefab target:RN <= 0.81 publishes the Hermes prefab module as
libhermes, exposed to CMake ashermes-engine::libhermes, while RN >= 0.82 useshermes-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.txtnow probes which Hermes prefab targetfind_package(hermes-engine)resolved. It linkshermes-engine::hermesvmon RN >= 0.82 andhermes-engine::libhermeson 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.sois 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.gradlealso excludes both**/libhermes.soand**/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-81with React Native0.81.0, wired Voltra through localfile:dependencies, ranvoltra apply --platform android --yes, and built:app:assembleDebugsuccessfully. Then I swapped the same app to published Voltra2.1.1; the build failed at:use-voltra_android-client:configureCMakeDebug[arm64-v8a]with the missinghermes-engine::hermesvmtarget. After restoring localfile: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.1currently fails before native compilation can complete.It also keeps RN >= 0.82 behavior intact, makes 16KB page-size compliance explicit, and avoids duplicate Hermes
.sopackaging across both Hermes prefab generations.