Skip to content

fix(android): link native libs with 16 KB page alignment - #81

Merged
MiloszFilimowski merged 1 commit into
masterfrom
fce-3717
Aug 21, 2026
Merged

fix(android): link native libs with 16 KB page alignment#81
MiloszFilimowski merged 1 commit into
masterfrom
fce-3717

Conversation

@MiloszFilimowski

Copy link
Copy Markdown
Collaborator

Problem

Google Play rejects app bundles containing @fishjam-cloud/react-native-webrtc@0.29.0 built with NDK r27 (the React Native 0.77–0.81 default): "Your app does not support 16 KB memory page sizes."

Three libraries are 4 KB-aligned (p_align 0x1000), and all three are the ones this fork compiles from source:

  • libfishjam-webrtc-audio.so
  • libwebrtc-custom-audio-track.so
  • libwebrtc-custom-video-track.so

Everything else (RN core, prefab libjsi/libfbjni/libc++_shared, prebuilt libjingle_peerconnection_so.so) is already 0x4000. Upstream react-native-webrtc compiles no native code, so there is nothing to port — the fix is ours.

Fix

Pass -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON to CMake, the same argument React Native core, Hermes, Expo modules core, Reanimated, Worklets, Screens and Gesture Handler pass. On NDK r27 it adds -Wl,-z,max-page-size=16384 for arm64-v8a/x86_64; on r28+ it is already the default (no-op). The ndkVersion fallback stays at 27.1.12297006 to match React Native's own default.

Verification

Built examples/mobile-client/fishjam-chat (Expo 54 / RN 0.81.5, NDK 27.1.12297006, the failing configuration) for arm64-v8a,x86_64 after a clean of android/build and android/.cxx:

  • build.ninja now contains max-page-size=16384 for arm64-v8a and x86_64 only (32-bit ABIs untouched).
  • llvm-readelf -lW over every 64-bit .so in the release APK: 52/52 LOAD segments at 0x4000, including the three libs above (before: 0x1000).
  • zipalign -c -P 16 -v 4 app-release.apkVerification successful.
  • Release AAB: 52/52 libs 0x4000; bundletool dump configPAGE_ALIGNMENT_16K.
  • Smoke test on a Pixel 9 Pro emulator (arm64): joined a room with camera + mic, no UnsatisfiedLinkError / crash in logcat.

Closes FCE-3717.

The three libraries this module compiles from source
(libfishjam-webrtc-audio, libwebrtc-custom-audio-track,
libwebrtc-custom-video-track) were linked with 4 KB page alignment on
NDK r27, so Google Play rejected app bundles with "does not support
16 KB memory page sizes". Pass ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON to
CMake, like React Native, Expo and Reanimated do; on NDK r27 this adds
-Wl,-z,max-page-size=16384 for arm64-v8a/x86_64, on r28+ it is already
the default.

FCE-3717
Copilot AI lite review requested due to automatic review settings August 21, 2026 09:53
@linear

linear Bot commented Aug 21, 2026

Copy link
Copy Markdown

FCE-3717

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@MiloszFilimowski
MiloszFilimowski merged commit 46b4cec into master Aug 21, 2026
8 checks passed
@MiloszFilimowski
MiloszFilimowski deleted the fce-3717 branch August 21, 2026 10:03
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.

3 participants