Summary
libscout_crash_handler.so ships with 4 KB ELF segment alignment (0x1000), so it
fails to load on Android devices using a 16 KB memory page size. This makes any app
that depends on scout_flutter non-compliant with Google Play's 16 KB page-size
requirement (mandatory for apps targeting Android 15+).
Every other native library in our app (Flutter engine, onnxruntime, pdfium, c++_shared,
etc.) is already ≥ 16 KB aligned — scout_flutter is the only one that isn't.
Version
scout_flutter: 0.1.21 (also confirmed unchanged in 0.1.22 — no alignment-related
entry in the changelog)
Evidence
Running llvm-readelf -l on the arm64-v8a libs bundled in the built APK:
libflutter.so 0x10000 (64 KB) ✅
libc++_shared.so 0x4000 (16 KB) ✅
libonnxruntime.so 0x4000 (16 KB) ✅
libmodpdfium.so 0x4000 (16 KB) ✅
...
libscout_crash_handler.so 0x1000 (4 KB) ❌
The LOAD segment alignment must be a multiple of 16384 (0x4000) for 16 KB-page devices.
Root cause
android/src/main/jni/CMakeLists.txt sets no page-size linker flags, and
android/build.gradle pins no ndkVersion. As a result the module resolves to
NDK r27, whose default ELF max-page-size is 4 KB. (NDK r28+ defaults to 16 KB,
which is why consumers on newer NDKs see every other lib aligned correctly, but this
plugin still compiles against the older resolved toolchain.)
Suggested fix
Either bump the plugin's ndkVersion to r28+ (16 KB by default), or opt in explicitly
so it works regardless of the resolved NDK. In android/src/main/jni/CMakeLists.txt:
target_link_options(scout_crash_handler PRIVATE
"-Wl,-z,max-page-size=16384,-z,common-page-size=16384")
(or add arguments "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON" to the plugin's
externalNativeBuild { cmake { ... } }.)
Workaround (for other consumers)
We patched it downstream by scoping an override onto the scout_flutter subproject in
our app's root android/build.gradle, which produces a correctly aligned 0x4000 lib:
subprojects {
plugins.withId('com.android.library') {
if (project.name == 'scout_flutter') {
android {
ndkVersion = "28.2.13676358"
defaultConfig {
externalNativeBuild {
cmake { arguments "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON" }
}
}
}
}
}
}
References
- https://developer.android.com/guide/practices/page-sizes
Summary
libscout_crash_handler.soships with 4 KB ELF segment alignment (0x1000), so itfails to load on Android devices using a 16 KB memory page size. This makes any app
that depends on
scout_flutternon-compliant with Google Play's 16 KB page-sizerequirement (mandatory for apps targeting Android 15+).
Every other native library in our app (Flutter engine, onnxruntime, pdfium, c++_shared,
etc.) is already ≥ 16 KB aligned —
scout_flutteris the only one that isn't.Version
scout_flutter: 0.1.21(also confirmed unchanged in0.1.22— no alignment-relatedentry in the changelog)
Evidence
Running
llvm-readelf -lon thearm64-v8alibs bundled in the built APK:libflutter.so 0x10000 (64 KB) ✅
libc++_shared.so 0x4000 (16 KB) ✅
libonnxruntime.so 0x4000 (16 KB) ✅
libmodpdfium.so 0x4000 (16 KB) ✅
...
libscout_crash_handler.so 0x1000 (4 KB) ❌
The LOAD segment alignment must be a multiple of 16384 (
0x4000) for 16 KB-page devices.Root cause
android/src/main/jni/CMakeLists.txtsets no page-size linker flags, andandroid/build.gradlepins nondkVersion. As a result the module resolves toNDK r27, whose default ELF
max-page-sizeis 4 KB. (NDK r28+ defaults to 16 KB,which is why consumers on newer NDKs see every other lib aligned correctly, but this
plugin still compiles against the older resolved toolchain.)
Suggested fix
Either bump the plugin's
ndkVersionto r28+ (16 KB by default), or opt in explicitlyso it works regardless of the resolved NDK. In
android/src/main/jni/CMakeLists.txt: