Skip to content

libbdk_dart_ffi.so is not 16 KB page-size aligned — fails Google Play's 16 KB requirement #88

Description

@Saleciani

Summary

The prebuilt Android shared library libbdk_dart_ffi.so shipped by bdk_dart has its PT_LOAD segments aligned to 4 KB (0x1000)
instead of 16 KB (0x4000). As a result, any app that bundles bdk_dart is rejected by the Google Play Console with:

Your app is not compatible with 16 KB memory page sizes.

Android 15+ runs with 16 KB memory pages on some devices, and Google now requires all native libraries to be 16 KB-aligned. This is
currently a warning you can bypass ("publish anyway") but becomes a hard requirement — apps that depend on bdk_dart will be blocked
from updating.

Environment

  • bdk_dart ref: v1.0.0-rc.1 (carries bdk-ffi 3.0.0 + uniffi-dart)
  • Consumed via the git dependency in pubspec.yaml
  • Flutter Android release build (flutter build appbundle/apk --release), NDK 27

Evidence

Inspecting the .so segment alignment of a release APK (every other native lib — libflutter.so, libapp.so,
libbreez_sdk_spark_flutter.so — is correctly 16 KB):

===== arm64-v8a =====
  OK  libapp.so                       minLOADalign=0x10000   (64K) OK
  OK  libbreez_sdk_spark_flutter.so   minLOADalign=0x4000    (16K) OK
  OK  libflutter.so                   minLOADalign=0x10000   (64K) OK
  XX  libbdk_dart_ffi.so              minLOADalign=0x1000    ( 4K) *** UNALIGNED ***

===== x86_64 =====
  XX  libbdk_dart_ffi.so              minLOADalign=0x1000    ( 4K) *** UNALIGNED ***

Reproduce on any .so with the Android NDK's check script or llvm-readelf:

# Google's helper:
./check_elf_alignment.sh libbdk_dart_ffi.so   # -> "UNALIGNED (LOAD segments not 16 KB)"

# or directly:
llvm-readelf -l libbdk_dart_ffi.so | grep LOAD
#   LOAD  ... 0x1000   <-- should be 0x4000 (16384) or larger

Expected

libbdk_dart_ffi.so (for the 64-bit ABIs arm64-v8a and x86_64) should be linked so its PT_LOAD segments are aligned to 16 KB
(0x4000) or larger, matching the rest of a modern Android app's native libraries.

Suggested fix

Pass the 16 KB max-page-size flag to the linker when building the Rust cdylib, e.g. in the Android build config / .cargo/config.toml
or via RUSTFLAGS:

# .cargo/config.toml (for the android targets)
[target.aarch64-linux-android]
rustflags = ["-C", "link-arg=-Wl,-z,max-page-size=16384"]

[target.x86_64-linux-android]
rustflags = ["-C", "link-arg=-Wl,-z,max-page-size=16384"]

Alternatively, building with NDK r28+ aligns PT_LOAD to 16 KB by default.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions