-
Notifications
You must be signed in to change notification settings - Fork 529
Android support for devices with 16k pages
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.
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.
- All the native 64-bit libraries must be rebuilt with flags enabling 16k alignment of data and code. This has to be done in addition to producing said libraries aligned to 4k.
We need to keep the 4k-aligned libraries in order to support developers with older devices and emulators (especially
x86_64
ones which don't natively support the 16k page size), as well as those developers who don't deploy their applications to Google Play Store (e.g. manufacturers of IoT devices or other embedded solutions running Android) - 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.
- 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 updatezipalign
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'.
The ro.product.cpu.pagesize.max
system property can be used to learn what's the device's maximum supported page size:
$ adb shell getprop ro.product.cpu.pagesize.max
16384
It will return 4096
for the 4k devices and 16384
for the 16k ones (including the "traditional", not Cuttlefish, emulator if the correct system image is installed)
- APK Tests on the Hyper V Emulator
- Design Time Build System
- Profile MSBuild Tasks
- Diagnose Fast Deployment Issues
- Preview layout XML files with Android Studio
- Documentation