Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions ANDROID_16KB_SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Android 16 KB Page Size Support

This document describes the changes made to support 16 KB memory page sizes required for Android 15+ compatibility.

## Background

Google Play requires all apps targeting Android 15+ (SDK 35+) to support 16 KB memory page sizes. This ensures compatibility with devices that use 16 KB memory pages instead of the traditional 4 KB pages for improved performance.

## Changes Made

### 1. Gradle Properties (`android/gradle.properties`)
- Added `android.enablePageSizeSupport=true` to enable 16 KB page size support
- Increased JVM heap size from 1536m to 2048m for better memory handling
- Added `android.enableR8.fullMode=true` for additional optimizations

### 2. App Build Configuration (`android/app/build.gradle`)
- Added NDK configuration with explicit ABI filters to ensure proper native library alignment
- Added packaging options to disable legacy packaging for proper 16 KB alignment
- Enhanced debug build type configuration

### 3. Build Tools
- Confirmed Android Gradle Plugin 8.9.1 is used (supports 16 KB page sizes)

## Verification

To verify that the app supports 16 KB page sizes:

1. **Build the app:**
```bash
cd android
./gradlew assembleRelease
```

2. **Test on 16 KB devices:**
- Use Android emulator with 16 KB page size configuration
- Test on physical devices with 16 KB page sizes
- Use Google Play Console's app bundle explorer to verify 16 KB support

3. **Check build output:**
- Ensure no errors related to memory alignment
- Verify all native libraries are properly packaged

## Google Play Console Verification

After building and uploading the app bundle to Google Play Console:
1. Go to Release management > App bundle explorer
2. Select the latest app bundle
3. Check if "16 KB page size support" is listed as supported

## Testing Recommendations

- Test the app on devices/emulators with 16 KB page sizes
- Verify all camera functionality works correctly
- Test media capture and storage operations
- Ensure all Capacitor plugins function properly

## References

- [Supporting 16 KB devices](https://developer.android.com/guide/practices/page-sizes#build)
- [Prepare your Play app for 16 KB page sizes](https://www.youtube.com/watch?v=MnMGJhuChRI)
- [Technical requirement announcement](https://android-developers.googleblog.com/2025/05/prepare-play-apps-for-devices-with-16kb-page-size.html)
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ The script does the same thing for you.
npm run build.android
```

#### Android 16 KB Page Size Support

This app supports 16 KB memory page sizes as required by Google Play for Android 15+ compatibility. The configuration is automatically enabled in the build system.

To verify 16 KB page size support:

```bash
./verify-16kb-support.sh
```

For detailed information about the 16 KB page size implementation, see [`ANDROID_16KB_SUPPORT.md`](./ANDROID_16KB_SUPPORT.md).

### Caveat

- This app is still in the experimental stage.
Expand Down
19 changes: 19 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ android {
versionCode 1032
versionName "0.103.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

// Support for 16 KB page sizes (Android 15+ requirement)
// This ensures compatibility with devices using 16 KB memory pages
ndk {
// Ensure native libraries are built with 16 KB page alignment
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
}
}
buildFeatures {
dataBinding true
Expand All @@ -19,6 +26,18 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
// Enable debugging and ensure 16 KB page size compatibility
debuggable true
}
}

// Configure packaging options for 16 KB page size compatibility
packagingOptions {
// Ensure native libraries are properly aligned for 16 KB page sizes
jniLibs {
useLegacyPackaging = false
}
}
}

Expand Down
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
// Android Gradle Plugin 8.9.1 supports 16 KB page sizes (Android 15+ requirement)
classpath 'com.android.tools.build:gradle:8.9.1'
classpath 'com.google.gms:google-services:4.4.2'

Expand Down
12 changes: 10 additions & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# Increased memory allocation for 16 KB page size compatibility
org.gradle.jvmargs=-Xmx2048m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand All @@ -19,4 +20,11 @@ org.gradle.jvmargs=-Xmx1536m
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
android.useAndroidX=true

# Enable 16 KB page size support for Android 15+ compatibility
# This ensures the app can run on devices with 16 KB memory page sizes
android.enablePageSizeSupport=true

# Additional optimizations for memory handling
android.enableR8.fullMode=true
55 changes: 55 additions & 0 deletions verify-16kb-support.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

# Build verification script for 16 KB page size support
# This script helps verify that the Android build configuration supports 16 KB page sizes

echo "🔧 Verifying Android 16 KB page size support..."

# Check if we're in the right directory
if [ ! -f "android/build.gradle" ]; then
echo "❌ Error: This script must be run from the project root directory"
exit 1
fi

echo "📋 Checking build configuration..."

# Check gradle.properties
if grep -q "android.enablePageSizeSupport=true" android/gradle.properties; then
echo "✅ Page size support enabled in gradle.properties"
else
echo "❌ Page size support not found in gradle.properties"
exit 1
fi

# Check Android Gradle Plugin version
if grep -q "com.android.tools.build:gradle:8\.[7-9]" android/build.gradle; then
echo "✅ Android Gradle Plugin version supports 16 KB page sizes"
else
echo "⚠️ Warning: Android Gradle Plugin version may not support 16 KB page sizes"
fi

# Check NDK configuration
if grep -q "abiFilters.*arm64-v8a" android/app/build.gradle; then
echo "✅ NDK configuration includes ARM64 support"
else
echo "❌ NDK configuration missing or incomplete"
exit 1
fi

# Check packaging options
if grep -q "useLegacyPackaging = false" android/app/build.gradle; then
echo "✅ Modern packaging enabled for proper alignment"
else
echo "❌ Legacy packaging configuration missing"
exit 1
fi

echo ""
echo "🎉 All 16 KB page size support configurations are in place!"
echo ""
echo "Next steps:"
echo "1. Build the app: cd android && ./gradlew assembleRelease"
echo "2. Test on 16 KB page size devices/emulators"
echo "3. Upload to Google Play Console and verify 16 KB support in bundle explorer"
echo ""
echo "For more information, see ANDROID_16KB_SUPPORT.md"