diff --git a/CLAUDE.md b/CLAUDE.md index 7a90f347..2e2e29df 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -77,6 +77,64 @@ git merge upstream/main # The .gitattributes file will help handle merge conflicts for renamed files ``` +### 16KB Page Size Compliance + +**Google Play Store Requirement**: Starting November 1st, 2025, all new apps and updates targeting Android 15+ devices must support 16 KB page sizes. + +#### Current Compliance Status +✅ **COMPLIANT** - This project has been updated to support 16KB page sizes across all Android device configurations. + +#### Implementation Details +The following changes have been implemented to ensure compliance: + +**Build Configuration:** +- **NDK Version**: r27.0.12077973 (supports 16KB by default) +- **Android Gradle Plugin**: 8.11.1+ (meets minimum requirement) +- **Target SDK**: 36 (Android 15+) + +**Native Library Configuration:** +- CMake linker flags: `-Wl,-z,max-page-size=16384` +- NDK r27 compilation flag: `-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON` +- Uncompressed native libraries in APK packaging + +**Modified Files:** +- `gradle.properties` - Added NDK r27 flexible page size support +- `shared/build.gradle.kts` - Configured uncompressed native libraries +- `lib/src/main/jni/whisper/CMakeLists.txt` - Added 16KB page size linker flags + +#### Testing 16KB Page Size Support + +**Verify Compliance on Device/Emulator:** +```bash +# Check current page size on connected device +adb shell getconf PAGE_SIZE + +# Expected output for 16KB compliance: 16384 +# Output of 4096 indicates 4KB page size (still supported but not the test target) +``` + +**Test on Android 15+ Emulator:** +1. Create Android 15 emulator with 16KB page size support +2. Install and test the application: `./gradlew installDebug` +3. Verify app functionality with both audio recording and transcription features +4. Confirm no crashes related to memory alignment issues + +**Build Verification Commands:** +```bash +# Clean build with 16KB compliance +./gradlew clean +./gradlew assembleDebug +./gradlew assembleRelease + +# Verify native libraries are built with correct alignment +# Check build logs for successful compilation with 16KB flags +``` + +#### Compliance Benefits +- ✅ **Future-proof**: Ready for Google Play Store requirement +- ✅ **Device Compatibility**: Supports both 4KB and 16KB page size devices +- ✅ **Performance**: Optimized memory alignment for Android 15+ devices +- ✅ **Backward Compatibility**: Maintains support for existing Android devices ### Release Workflow diff --git a/gradle.properties b/gradle.properties index e6ccb4df..ac629340 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,3 +16,7 @@ org.jetbrains.compose.experimental.uikit.enabled=true kotlin.native.cacheKind=none android.ndkVersion=27.0.12077973 + +android.native.buildOutput=verbose +android.native.useNativeCompilerSettingsCache=false +org.gradle.configuration-cache=true diff --git a/lib/src/main/jni/whisper/CMakeLists.txt b/lib/src/main/jni/whisper/CMakeLists.txt index 5883d55d..f18ef320 100644 --- a/lib/src/main/jni/whisper/CMakeLists.txt +++ b/lib/src/main/jni/whisper/CMakeLists.txt @@ -1,5 +1,10 @@ cmake_minimum_required(VERSION 3.10) add_link_options("LINKER:--build-id=none") + +# 16KB Page Size Support - Required for Google Play Store (November 1st, 2025) +# Add linker flags for 16KB page size alignment on Android 15+ devices +add_link_options("LINKER:-z,max-page-size=16384") + project(whisper.cpp) set(CMAKE_CXX_STANDARD 17) @@ -16,6 +21,9 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") # Disable timestamps - ADDED add_definitions(-DGGML_NO_TIMESTAMPS=1) +# 16KB Page Size Support: Add NDK r27 flexible page size compilation flag +add_definitions(-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON) + # Path to external GGML, otherwise uses the copy in whisper.cpp. option(GGML_HOME "whisper: Path to external GGML source" OFF) @@ -81,6 +89,10 @@ function(build_library target_name) target_link_options(${target_name} PRIVATE -Wl,--gc-sections) target_link_options(${target_name} PRIVATE -Wl,--exclude-libs,ALL) target_link_options(${target_name} PRIVATE -flto) + + # 16KB Page Size Support - Required for Google Play Store (November 1st, 2025) + # Add linker flags for 16KB page size alignment on Android 15+ devices + target_link_options(${target_name} PRIVATE -Wl,-z,max-page-size=16384) endif () if (GGML_HOME) diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index cb1d59ab..d3577afc 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -168,6 +168,9 @@ android { // Force consistent ordering jniLibs { useLegacyPackaging = true + // 16KB Page Size Support: Use uncompressed native libraries + // Required for Google Play Store compliance (November 1st, 2025) + pickFirsts += listOf("**/libc++_shared.so", "**/libwhisper.so") } } buildTypes {