You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android libraries are 4 KB aligned when the build hook gets an NDK older than r28 (Google Play 16 KB rule) #116
The Flutter tool hands the build hook the NDK of ANDROID_NDK_HOME before Gradle's ndkVersion. On GitHub's ubuntu-24.04 runners that is NDK r27d, whose linker aligns LOAD segments on 4 KB, so in our app the Rust library was the only 64 bit library of the APK below 16 KB, while Gradle built the rest with r28c. Google Play requires 16 KB alignment for the 64 bit libraries of apps targeting Android 15 or later, and from 1 February 2027 it will no longer accept updates that do not meet it (Support 16 KB page sizes). Adding -C link-arg=-Wl,-z,max-page-size=16384 to the Android targets in .cargo/config.toml fixed it whatever the NDK; fzyzcjy/flutter_rust_bridge#3426 proposes the same for its own Native Assets path. Would you take a pull request that passes this flag by default for the Android targets? It is harmless with r28 and later, which already align on 16 KB.
For reference, the flag as we pass it, on the three Android targets:
LLD keeps the last max-page-size it is given, so the flag wins over the 4 KB default of an older NDK. With a linker wrapper that passes 4 KB first, as the r27 driver does, readelf -lW showed 0x4000 on every LOAD segment of the three targets with the flag, and 0x1000 without it.
Hey, thanks for opening the issue. If this change doesn’t break pre-existing builds or older devices (doesn’t seem like it would?) then a PR would be welcome. For some reason I thought we already had support for that here from another issue that was opened previously, but clearly I’m remembering wrong if it’s still an issue.
Thanks for the quick answer. I opened #117: it passes the flag for the two 64 bit Android targets through a small wrapper around the NDK's clang, so the user's rustflags are left alone, and with NDK r28 the built library comes out byte for byte the same as today.
Activity
GregoryConrad commentedon Oct 21, 2026
Hey, thanks for opening the issue. If this change doesn’t break pre-existing builds or older devices (doesn’t seem like it would?) then a PR would be welcome. For some reason I thought we already had support for that here from another issue that was opened previously, but clearly I’m remembering wrong if it’s still an issue.
freeKC commentedon Oct 22, 2026
Thanks for the quick answer. I opened #117: it passes the flag for the two 64 bit Android targets through a small wrapper around the NDK's clang, so the user's rustflags are left alone, and with NDK r28 the built library comes out byte for byte the same as today.