Skip to content

Android support for devices with 16k pages

Jonathan Pobst edited this page Jul 1, 2024 · 17 revisions

DotNet issue tracking this: https://github.com/dotnet/runtime/issues/103360

.NET Android draft PR: https://github.com/dotnet/android/pull/9020

Please add all the relevant information here, in addition to the issue above. Having it here makes it easier to read than to read through the discussion in the GH issue.

Summary

Android is moving towards supporting devices with 16k memory page size, for the x64 and arm64 architectures. This affects all the native components of the application. In our case it means the MonoVM runtime, the BCL support libraries and .NET for Android native runtime and libraries.

Google plan to make support for 16k devices a requirement for Google Play application submissions next year.

A lot of work needs to be done.

Google have an article with more technical details.

How it affects our ecosystem

  • All the native libraries must be rebuilt with flags enabling 16k alignment of data and code
  • Code review of native (and maybe some managed?) code needs to be done in order to make sure we don't assume 4k page size anywhere. This includes MonoVM runtime/JIT/interpreter code.
  • APK/AAB archives we build must be aligned to 16k, instead of the current 4k
  • We need to start using Cuttlefish virtual Android devices on our CI
    • It requires a Linux VM with KVM enabled
    • It can run on Docker. This should enable using Cuttlefish on macOS and Windows VMs
  • It looks like Google provides VanillaIceCream emulators that support 16K files now.
    • image

Required changes

  • Visual Studio must create/update emulators it manages to use 16k system images (Cuttlefish via WSL?)
  • Android SDK build-tools v35.0.0-rc4 or newer are required. They contain an update zipalign utility which adds the -P parameter, indicating target page size of the APK being aligned:
-P <pagesize_kb>: Align uncompressed .so files to the specified
                    page size. Valid values for <pagesize_kb> are 4, 16
                    and 64. '-P' cannot be used in combination with '-p'.

Related resources

Clone this wiki locally