From dee32a0ed011ba9e3fe116335338d4e32fd68200 Mon Sep 17 00:00:00 2001 From: Jae B Date: Wed, 22 Apr 2026 18:22:41 +1000 Subject: [PATCH 1/2] make default aligned page size 16kb --- src/androidbuild/Apk.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/androidbuild/Apk.zig b/src/androidbuild/Apk.zig index 75b3bb4..462eb34 100644 --- a/src/androidbuild/Apk.zig +++ b/src/androidbuild/Apk.zig @@ -796,6 +796,14 @@ fn setLibCFile(apk: *Apk, compile: *Step.Compile) void { fn updateArtifact(apk: *Apk, artifact: *Step.Compile, raw_top_level_apk_files: *Step.WriteFile) void { const b = apk.b; + // Set page size to 16KB-aligned binaries by default + // + // For Android NDK r27 onwards, Android recommends the following setting by default + // Source: https://developer.android.com/guide/practices/page-sizes#compile-r27 + if (artifact.link_z_max_page_size == null) { + artifact.link_z_max_page_size = 16384; + } + // If you have a library that is being built as an *.so then install it // alongside your library. // From 2c756d05b3973f3f15d1bd1f4ac9cd5db2bdf6d6 Mon Sep 17 00:00:00 2001 From: Jae B Date: Thu, 23 Apr 2026 18:05:14 +1000 Subject: [PATCH 2/2] improve comment --- src/androidbuild/Apk.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/androidbuild/Apk.zig b/src/androidbuild/Apk.zig index 462eb34..60ea8d6 100644 --- a/src/androidbuild/Apk.zig +++ b/src/androidbuild/Apk.zig @@ -800,6 +800,11 @@ fn updateArtifact(apk: *Apk, artifact: *Step.Compile, raw_top_level_apk_files: * // // For Android NDK r27 onwards, Android recommends the following setting by default // Source: https://developer.android.com/guide/practices/page-sizes#compile-r27 + // + // NOTE(jae): 2026-04-23 + // Zig 0.16.0 stable does not do this by default and without this line, there is a pop-up + // warning when testing on Pixel 10, Android 17 VM device. + // Screenshot is on Github issue here: https://github.com/silbinarywolf/zig-android-sdk/issues/87 if (artifact.link_z_max_page_size == null) { artifact.link_z_max_page_size = 16384; }