From 926d4abb6c593a22a171753183c51fca0e9ecd24 Mon Sep 17 00:00:00 2001 From: Nicolas CHAUVIN Date: Tue, 11 Aug 2026 10:00:50 +0200 Subject: [PATCH] chore(android): align native libraries to 16 KB pages --- .cargo/config.toml | 9 +++++++++ android/app/build.gradle.kts | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..16e133e --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,9 @@ +# Align Android native libraries to a 16 KB max page size. Android 15 requires +# 16 KB-aligned ELF LOAD segments on 16 KB-page devices; the NDK linker still +# defaults to 4 KB (0x1000) up to NDK r27. Applies only to the Android targets, +# which are built solely for the `mobile` crate. See issue #79. +[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"] diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index e38894b..be7d9ee 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -105,7 +105,8 @@ dependencies { val composeBom = platform("androidx.compose:compose-bom:2024.09.03") // UniFFI-generated Kotlin needs JNA (with the @aar classifier on Android). - implementation("net.java.dev.jna:jna:5.14.0@aar") + // 5.15+ ships 16 KB-aligned native libs (Android 15 requirement, #79). + implementation("net.java.dev.jna:jna:5.15.0@aar") // JVM unit tests for the pure Kotlin editor transforms (no device, no native // lib: the UniFFI bindings load libplain_note_mobile.so lazily on the first