Flutter + Google Play: Fix 16 KB Memory Page Size Rejection
Overview
Many Flutter developers have recently faced Google Play rejections due to the new 16 KB memory page size requirement for Android apps.
This issue often stems from native libraries (.so files) not being aligned to 16 KB pages, causing app submissions to fail. Below is a proven, step-by-step solution to resolve this issue and ensure your Flutter app passes Google Play’s checks.
Follow these steps to update your Flutter project and avoid last-minute surprises when uploading to the Play Console.
🔹 Steps to Fix 16 KB Page Size Issue
- 🚀 Upgrade Flutter SDK: Use version 3.35.2 or higher to ensure compatibility with the latest requirements.
- 📦 Update Packages: Run
flutter pub upgrade --major-versions
to update all dependencies to their latest compatible versions. - 🛠️ Gradle Upgrade: Update to Gradle 8.7 (or the latest version) in your project’s
gradle-wrapper.properties
. - 🔌 Android Gradle Plugin: Use version 8.5.1 or higher in your
build.gradle
. - 📱 NDK: Use NDK r28 or higher, as it builds 16 KB-aligned .so files by default.
- ⚙️ Update Build Configs: Modify
android/app/build.gradle
orbuild.gradle.kts
to ensure proper configuration. - 🔍 Verify APK: Use Android Studio’s Analyze APK tool to check .so files for 16 KB alignment.
- ✅ Upload to Play Console: Submit your updated APK or AAB to the Play Console and confirm compliance.
Implementation Details
Below are the key configurations to update in your Flutter project to meet the 16 KB page size requirement.
Step 1: Upgrade Flutter SDK
Ensure you’re using Flutter 3.35.2 or higher. Check your current version and upgrade if needed.
flutter --version
flutter upgrade
Step 2: Update Dependencies
Update all packages in your pubspec.yaml
to their latest versions.
flutter pub upgrade --major-versions
Step 3: Upgrade Gradle
In android/gradle/wrapper/gradle-wrapper.properties
, update the Gradle version to 8.7 or higher.
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
Step 4: Update Android Gradle Plugin
In android/build.gradle
, update the Android Gradle Plugin to 8.5.1 or higher.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:8.5.1'
}
}
Step 5: Configure NDK
In android/app/build.gradle
, set the NDK version to r28 or higher.
android {
compileSdk 34
ndkVersion "28.0.12433566"
defaultConfig {
applicationId "com.example.app"
minSdk 21
targetSdk 34
versionCode 1
versionName "1.0"
}
}
Step 6: Verify APK
After building your APK, use Android Studio’s Analyze APK tool to ensure all .so files are 16 KB-aligned. Check the lib
folder in the APK for native libraries.
flutter build apk --release
Step 7: Upload to Play Console
Build your app bundle or APK and upload it to the Google Play Console. Verify compliance in the App Bundle Explorer.
flutter build appbundle --release
Key Features Table
Step | Description | Pros | Cons |
---|---|---|---|
🚀 Flutter SDK Upgrade | Upgrade to 3.35.2 or higher. | Ensures compatibility, latest features. | May require code adjustments. |
📱 NDK r28 | Use NDK r28 for 16 KB-aligned builds. | Automatic 16 KB alignment. | Larger binary size. |
🔍 APK Verification | Analyze APK for .so file alignment. | Ensures compliance before submission. | Requires manual check. |
FAQ
❓ Why does Google Play enforce the 16 KB page size?
Google Play requires 16 KB page size alignment for native libraries to optimize memory usage on modern Android devices, improving performance and compatibility.
🛠️ Do I need to update all dependencies?
Yes, updating dependencies with flutter pub upgrade --major-versions
ensures compatibility with the latest Flutter SDK and NDK requirements.
🔍 How do I check .so file alignment?
Use Android Studio’s Analyze APK tool or a command-line tool like readelf
to verify that .so files are 16 KB-aligned.
✅ What if my app still gets rejected?
Double-check your NDK version and .so file alignment. Ensure all native libraries are built with NDK r28 or higher, and re-upload to the Play Console.
Community Feedback
Have you faced issues with the 16 KB page size requirement or found alternative fixes? Share your tips in the comments to help the Flutter community. We’ll update this guide with your feedback!
Join Reddit for more Flutter updates: r/AndroidDevLearn