Skip to content

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

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

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

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