Blog Infos
Author
Published
Topics
, , , ,
Published

Image Source: ChatGPT

Background: Page Size in Android

Memory page size is the basic unit at which an operating system manages memory. Historically, Android devices have used a 4 KB page size for memory management. This means all memory allocations and files loaded in memory are aligned to 4 KB boundaries.

Starting with Android 15 (API level 35), however, Android adds support for 16 KB memory pages. In other words, newer devices may use 16 KB pages instead of the traditional 4 KB.

Think of memory pages like storage boxes in a library. Traditionally, each box could hold 4,096 bytes of data — like a small box that holds a limited number of books. With Android 15, the system can use boxes four times larger (16,384 bytes). Fewer, larger boxes mean you can store the same data with fewer boxes to keep track of, simplifying management and potentially speeding up retrieval (though each box may occasionally use a bit more space than needed).

Image Source: ChatGPT

Why Move to 16 KB Pages? (And Benefits)

As devices gain more RAM, the overhead of managing memory in tiny 4 KB chunks grows. Using 16 KB pages reduces the number of pages the system must track and map, which can improve performance by reducing page table size and TLB misses (similar to how a larger tile covers more floor area with fewer seams than many small tiles). Google’s testing has shown concrete benefits on 16 KB page devices, for both the system and apps:

  • Faster app launch times under memory pressure
  • Lower power usage during app launch
  • Quicker camera startup
  • Shorter device boot time

These gains come from the efficiency of handling memory in larger chunks.

There is a slight trade-off: 16 KB pages use a bit more memory on average due to internal fragmentation, since even a small allocation will occupy a 16 KB slot. But in devices with lots of RAM, this trade-off is acceptable for the speed improvements.

Google Play’s 16 KB Page Size Requirement

To ensure apps take advantage of these improvements (and to avoid apps breaking on future devices), Google Play is mandating 16 KB page size support for apps targeting the latest platform.

Starting November 1, 2025: All new apps and updates to existing apps submitted to Google Play that target Android 15 (API 35) or above must support 16 KB memory pages on 64-bit devices. In practice, this means your app’s native code (if any) must be built with 16 KB alignment and packaging rules. If your app doesn’t meet this, Google Play will block the release (you’ll see an error in Play Console and cannot publish the app/update).

Google Play Console already shows warnings for apps that are not compliant (e.g., a warning stating “Memory page size: Does not support 16 KB” in your app’s Pre-Launch report or Bundle details. Developers should act now to avoid a last-minute rush.

How to Check if Your App Is Affected

Whether your app needs changes depends on whether you use native code. If your app is written entirely in Java and/or Kotlin (with only standard managed libraries), then good news — your app already supports 16 KB pages by default. Pure Java/Kotlin apps do not include native binaries, so there’s no alignment issue to worry about. (It’s still wise to test on a 16 KB device if possible, just to be sure nothing odd happens, but generally no code changes are needed in this case.)

However, if your app uses any native code, either via your own C/C++ code or through third-party SDKs that include .so libraries, then you will likely need to rebuild or update those components. Here’s how to assess your app:

  1. Use Android Studio’s APK Analyzer

In Android Studio, you can open Build > Analyze APK (or Analyze App Bundle) on your app’s APK/AAB.

Look under the “lib” section for any .so files (native libraries). If you see native libraries for any architecture, that means your app includes native code (and thus needs 16 KB support).

Android Studio might also issue warnings during build for alignment issues

Note: There was a known Android Studio bug in version 2025.1.2 (Narwhal) regarding the 16 KB check. The APK Analyzer would sometimes not flag AAB issues correctly — an app bundle might appear fine in Studio even though Play Console/emulator showed errors. The fix was released in Android Studio 2025.1.3So make sure you update Android Studio to the latest version (or at least 2025.1.3 RC or newer) to get accurate feedback.

2. Check Google Play Console

Upload your app bundle to the Play Console (even as an internal test). The App Bundle Explorer now shows a “Memory page size” field. If your app is compliant, it will say “Supports 16 KB”, but if not, it will indicate “Does not support 16 KB.”

If your app only uses Java/Kotlin (no .so libraries at all), you’re essentially in the clear by default. But if any native code is present, plan to update those native parts.

Preparing Your App for 16 KB Pages

To make your app fully 16 KB-compatible (and pass the Google Play requirement), you’ll need to update your build configuration and possibly some code. Here are the essential steps:

1. Update Android Studio and Build Tools:

Use the latest stable Android Studio (or at least Android Studio 2025.1.3+ (Narwhal) or newer) and update your Android Gradle Plugin (AGP) and NDK to versions that natively support 16 KB. Specifically:

a. Android Gradle Plugin 8.5.1 or higher — AGP 8.5.1+ will ensure that when you build an App Bundle (AAB) with uncompressed native libs, the bundletool will zip-align those .so files on 16 KB boundaries.

The following combination of Kotlin, Hilt, Gradle, and AGP versions has worked well for me:

// Project level build.gradle
kotlin_version = "2.1.0"
hilt_version = "2.57.1"
classpath 'com.android.tools.build:gradle:8.13.0'

// gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip

 

If, for some reason, you cannot update AGP, one workaround is to fall back to compressed native libraries (so that zip alignment doesn’t matter, since the OS will extract them). This is done by adding the following:

android {
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
}

 

b. NDK r28 or higher — Android NDK r28 (and beyond) by default compiles shared libraries with 16 KB ELF segment alignment. This means simply rebuilding your C/C++ code with NDK r28+ will produce .so files aligned to 16384 bytes, which the OS on 16 KB devices can load normally.

android {
ndkVersion "29.0.14206865"
}

 

If you’re using an older NDK, it’s strongly recommended to upgrade.

2. Rebuild Native Code with 16 KB Alignment:

After updating the NDK, clean and rebuild all your native libraries. With NDK r28+, no special action is needed — the default build will align segments on 16 KB. Make sure any prebuilt native libraries you include (from SDKs or third parties) are also rebuilt or updated for 16 KB. If you vendored some .so from an old SDK, you’ll need a 16 KB-aligned update from the vendor or recompile it from source.

3. Remove 4 KB Assumptions in Code

Search your code (and your native code) for any references to page size constants or assumptions that the page size is 4096. A Common mistake is the use of the constant PAGE_SIZE (from <unistd.h> or <sys/user.h> in native code) or any hard-coded 4096 that might be used for memory alignment. Use getpagesize() or sysconf(_SC_PAGESIZE) in C/C++ to get the actual page size at runtime.

4. Update Third-Party SDKs and Libraries

Check all your dependencies (especially those that use native code) for 16 KB support. This includes external SDKs for databases (e.g., SQLCipher), analytics, ML (TensorFlow Lite, ML Kit), game engines, etc. Most major SDK providers have released updates by now for 16 KB compatibility.

Android Studio’s Lint sometimes shows a warning when you hover over a dependency that is not 16KB

In many cases, simply bumping the version of an SDK will solve alignment issues.

i̶m̶p̶l̶e̶m̶e̶n̶t̶a̶t̶i̶o̶n̶ ‘c̶o̶m̶.g̶o̶o̶g̶l̶e̶.m̶l̶k̶i̶t̶:̶t̶e̶x̶t̶-̶r̶e̶c̶o̶g̶n̶i̶t̶i̶o̶n̶:̶1̶6̶.0̶.0̶’ i̶m̶p̶l̶e̶m̶e̶n̶t̶a̶t̶i̶o̶n̶ ‘c̶o̶m̶.g̶o̶o̶g̶l̶e̶.m̶l̶k̶i̶t̶:̶f̶a̶c̶e̶-̶d̶e̶t̶e̶c̶t̶i̶o̶n̶:̶1̶6̶.1̶.5̶’ implementation ‘com.google.mlkit:text-recognition:16.0.1’ implementation ‘com.google.mlkit:face-detection:16.1.7’

 

If a library you rely on hasn’t been updated (and especially if it’s no longer maintained), you may need to reach out to the vendor or consider finding an alternative solution.

5. Test Thoroughly in a 16 KB Environment

Once you’ve rebuilt and updated everything, it’s important to test your app on a system with a 16 KB page size. This will help catch any runtime issues (e.g., if something still assumes 4 KB and fails, or any performance regressions).

Android Studio includes emulator system images configured for 16 KB pages. In the SDK Manager, enable “Show Package Details” and scroll to Android 15 (UpsideDownCake/VanillaIceCream) — you’ll see special system images labeled “Pre-Release 16KB Page Size Google Play” for ARM64 and Intel x86_64. Install the image for the architecture you want.

Then create a new Virtual Device (AVD) and select this 16 KB image. Launch the emulator.

Now install your app on this emulator and use it as you normally would. Pay attention to logcat for any unusual errors.

Use a Physical Device (Pixel) with 16 KB Mode: If you have a Pixel 8, Pixel 8 Pro, Pixel 8a, or Pixel 9/9 Pro/9 Pro XL, and you can run at least Android 15 QPR1 (for Pixel 8 series) or Android 15 QPR2 Beta (for Pixel 9 series), you can enable an experimental developer option to reboot the phone into 16 KB page mode.

After rebuilding the APK, you can manually verify your APK’s alignment using the zipalign tool. Run

zipalign -c -P 16 -v 4 YourApp.apk.

 

This will check that all uncompressed files in the APK are aligned to 16 bytes * 1024 (which is 16384). It’s an extra assurance that your packaging is correct. If this passes and your .so binaries were built with 16 KB segments, you should be good to go.

Job Offers

Job Offers

There are currently no vacancies.

OUR VIDEO RECOMMENDATION

,

Migrate to Google Play Billing v5

Google announced at Google I/O this year their new version for Google Play Billing that changes everything for In-App Subscription
Watch Video

Migrate to Google Play Billing v5

Kevin Herembourg
Head of Mobile
Purchasely

Migrate to Google Play Billing v5

Kevin Herembourg
Head of Mobile
Purchasely

Migrate to Google Play Billing v5

Kevin Herembourg
Head of Mobile
Purchasely

Jobs

Final Tips and Recap

By November 2025, developers must ensure their apps are ready for the 16 KB page size era. This primarily impacts apps with native code. To recap the key actions:

  • Upgrade your toolchain (AGP 8.5.1+, NDK r28+) so that new builds naturally meet alignment requirements.
  • Rebuild or update all native libraries with 16 KB alignment. Don’t forget libraries from SDKs or game engines — use updated versions provided by those SDKs (many have already prepared updates).
  • Test on a 16 KB emulator or device to catch issues early. Resolve any crashes or warnings observed in that environment.
  • Use Play Console tools (App Bundle Explorer, pre-launch reports) to verify your app shows “Supports 16 KB” and no longer triggers the policy warning.

If you run into obstacles (e.g., a third-party SDK isn’t ready), communicate with the SDK vendor immediately or seek alternatives. In worst-case scenarios, apply for the 6-month extension to buy time— but note that the extension only extends to May 31, 2026, and it’s a one-time reprieve.

You’ll still need to comply eventually, and the sooner the better to avoid any user-facing issues.

Android’s move to 16 KB pages is a forward-looking change to improve performance on future hardware. By investing the time to make your app compatible, you not only satisfy Play Store policy but also potentially make your app run faster and more efficiently on tomorrow’s devices.

This article was previously published on proandroiddev.com

Menu