ONNX Runtime 16 KB page-size fix: upgrade to 1.21.1
Artifact com.microsoft.onnxruntime:onnxruntime-android · measured 2026-10-01 · all libraries
fixed
ONNX Runtime versions up to and including 1.21.0 that we measured ship 4 KB-aligned native libraries (offending for Google Play's 16 KB page-size requirement). The first measured aligned stable version is 1.21.1; the newest measured, 1.30.0, is aligned.
- Sampled, not exhaustive: 31 of 38 published versions were measured with native code; unmeasured versions in between are unknown.
Measured evidence
| Version | Library file | p_align | File date | Source | |
|---|---|---|---|---|---|
| Last offending | 1.21.0 | jni/arm64-v8a/libonnxruntime4j_jni.so | 4 KB (2^12) | Fri, 07 Mar 2025 21:58:51 GMT | artifact |
| First aligned | 1.21.1 | jni/arm64-v8a/libonnxruntime.so | 16 KB (2^14) | Mon, 21 Apr 2025 09:55:17 GMT | artifact |
p_align is the smallest PT_LOAD segment alignment of the ELF. 16 KB-compatible needs at least 16384 (2^14). Method: min PT_LOAD p_align of arm64-v8a/x86_64 .so inside the published AAR/JAR; aligned = >=16384 for every lib. Dates are repository file times, not official release dates.
Offending versions measured (16)
1.11.0, 1.12.0, 1.12.1, 1.13.1, 1.14.0, 1.15.0, 1.15.1, 1.16.0, 1.16.0-rc1, 1.16.2, 1.16.3, 1.17.1, 1.17.3, 1.19.0, 1.20.0, 1.21.0
Native libraries seen: libonnxruntime.so, libonnxruntime4j_jni.so.
The Gradle change
implementation("com.microsoft.onnxruntime:onnxruntime-android:1.21.1")an aligned version, lowest measured above the last offending one; newer measured versions are aligned too (latest 1.30.0). Check: ./gradlew :app:dependencyInsight --dependency onnxruntime-android --configuration releaseRuntimeClasspath
Confirm what Gradle actually resolves, since another dependency may pull an older version:
./gradlew :app:dependencyInsight --dependency onnxruntime-android --configuration releaseRuntimeClasspathRe-verify it yourself
Download the artifact and run the free checker (check16k.py, Python 3, no dependencies):
curl -LO https://repo1.maven.org/maven2/com/microsoft/onnxruntime/onnxruntime-android/1.21.1/onnxruntime-android-1.21.1.aar
python3 check16k.py onnxruntime-android-1.21.1.aarExit 0 = aligned, 1 = an unaligned library found. Better still, run it on your final .aab/.apk.
The paid kit ($12, v2) contains the complete measured fix map for all 80+ libraries as JSON and a table, every raw per-version measurement, the spot-check evidence, and the step-by-step guide for Play's 16 KB requirement. This page and the checker script stay free.
Get the kit ($12)Related artifacts
- ONNX Runtime training (com.microsoft.onnxruntime:onnxruntime-training-android)