Skip to content

fix(android): pin onnxruntime to 1.22.0 for 16 KB page-size alignment - #5

Closed
amadeu01 wants to merge 1 commit into
quickpose:mainfrom
amadeu01:fix/android-16kb-page-size
Closed

fix(android): pin onnxruntime to 1.22.0 for 16 KB page-size alignment#5
amadeu01 wants to merge 1 commit into
quickpose:mainfrom
amadeu01:fix/android-16kb-page-size

Conversation

@amadeu01

Copy link
Copy Markdown

Problem

Android 15 introduces 16 KB memory page support (required on Pixel 9+ and future devices). Apps with native libraries not aligned to 16 KB boundaries show an Android App Compatibility warning at launch and will fail alignment checks on devices with 16 KB pages enforced.

Running the app on an Android 15 emulator reports the following unaligned libraries:

lib/x86_64/libappmodules.so       : Unknown error
lib/x86_64/libopencv_java4.so     : Unknown error
lib/x86_64/libonnxruntime.so      : Unknown error
lib/x86_64/libonnxruntime4j_jni.so: Unknown error

Root cause

libonnxruntime.so and libonnxruntime4j_jni.so originate from the transitive dependency:

com.microsoft.onnxruntime:onnxruntime-android:latest.release

Microsoft added 16 KB page-size alignment support in ONNX Runtime 1.20.0 (see ONNX Runtime Android build docs). Using latest.release can resolve to older artefacts on some Gradle setups, and the floating label makes it impossible to guarantee the fix.

Fix

Pin onnxruntime-android to 1.22.0 (current latest, first stable release line with 16 KB support):

-    implementation "com.microsoft.onnxruntime:onnxruntime-android:latest.release"
+    // Pinned to 1.20.0+ which introduced 16 KB page-size alignment support.
+    implementation "com.microsoft.onnxruntime:onnxruntime-android:1.22.0"

Remaining issue (needs upstream fix)

libopencv_java4.so and libappmodules.so come from the prebuilt AARs inside:

  • ai.quickpose:quickpose-mp:0.6
  • ai.quickpose:quickpose-core:0.21

These need to be recompiled with -Wl,-z,max-page-size=16384 (or the equivalent NDK CMake flag -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON) and republished to Maven. This cannot be fixed from the React Native wrapper — it requires rebuilding and republishing those Maven artifacts.

References

@pablonosh

Copy link
Copy Markdown
Collaborator

Thanks for the detailed writeup — closing after verifying, though. latest.release resolves to onnxruntime-android 1.28.0 today, and Microsoft has shipped 16 KB-aligned builds since 1.20.0 (late 2024), so the pin would actually downgrade consumers. On the AAR side: quickpose-mp 0.6 already ships 16 KB alignment (added in quickpose-core v0.16/v0.17) — we checked the ELF LOAD alignment of every .so in the published AAR and all arm64-v8a/x86_64 libs, including libopencv_java4.so, are 16384-aligned. The "Unknown error" results from the emulator compat check aren't alignment failures (it also flags libappmodules.so, which is the app's own RN codegen output).

@pablonosh pablonosh closed this Aug 1, 2026
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.

2 participants