Skip to content

fix(android): align librnmbxnav.so to 16 KB page size - #36

Open
alternacrow wants to merge 1 commit into
rnmapbox:mainfrom
alternacrow:fix/16kb-page-size
Open

alternacrow wants to merge 1 commit into
rnmapbox:mainfrom
alternacrow:fix/16kb-page-size

Conversation

@alternacrow

Copy link
Copy Markdown

Problem

librnmbxnav.so is linked with 4 KB segment alignment, so apps that bundle @rnmapbox/navigation are reported as incompatible with 16 KB page size devices on Android 15+. Google Play requires 16 KB support for apps targeting Android 15 and above.

In an app using @rnmapbox/navigation@0.1.2, librnmbxnav.so was the only one of the 47 arm64-v8a libraries in the APK that was not 16 KB aligned:

$ llvm-readelf -lW lib/arm64-v8a/librnmbxnav.so | awk '$1=="LOAD"{print $NF}' | sort -u
0x1000

# every other .so in the same APK
0x4000

The device shows a compatibility warning for the app because of this one library.

Cause

NDK r27 only passes -Wl,-z,max-page-size=16384 when ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON is set; it became the default in r28. android/build.gradle passes only -DANDROID_STL=c++_shared to CMake, so the flag is missing from the link command.

Other React Native libraries that ship native code already set it, e.g. react-native-screens and react-native-reanimated.

Fix

Add -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON to the CMake arguments. This is a no-op on NDK r28+, where it is already the default.

Verification

Rebuilt the same app with the patch applied:

# before
0x1000 librnmbxnav.so

# after
0x4000 librnmbxnav.so   (all 47 arm64-v8a libraries now >= 16 KB)

Built with Expo SDK 58 / React Native 0.88, NDK 27.1.12297006.

🤖 Generated with Claude Code

NDK r27 only emits 16 KB-aligned segments when
ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES is set; it became the default in
r28. Without it, librnmbxnav.so is linked with 4 KB alignment and apps
that bundle it are flagged as incompatible on Android 15+ devices with
16 KB pages.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant