Need support for 16KB page size on Android #45054
Labels
Never gets stale
Prevent those issues and PRs from getting stale
Platform: Android
Android applications.
Description
Android 15 offers an option for OEMs to use a 16KB page size for better performance [1]. This change is significant, as all shared objects (
.so
files in APKs) must be recompiled with the new page size. According to the Android team [2][3], 16KB page size compatibility will be required for app uploads to the Play Store next year (2025).It seems that React-Native is not compatible with the 16KB page size. If I try to run a React-Native project on an emulator with a 16KB page size, I get the following error in the logcat:
I checked all shared objects in the APK using my script check_elf_page_size.py and found that all shared objects use a 4KB page size.
$ check_elf_page_size.py android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/*.so Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libc++_shared.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libexpo-modules-core.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libfabricjni.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libfbjni.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libfolly_runtime.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libgifimage.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libglog.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libhermes.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libhermes_executor.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libhermesinstancejni.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libimagepipeline.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libjscinstance.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libjsi.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libjsijniprofiler.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libjsinspector.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libmapbufferjni.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libnative-filters.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libnative-imagetranscoder.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_codegen_rncore.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_cxxreactpackage.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_debug.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_devsupportjni.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_featureflags.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_featureflagsjni.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_nativemodule_core.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_newarchdefaults.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_render_componentregistry.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_render_core.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_render_debug.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_render_element.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_render_graphics.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_render_imagemanager.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_render_mapbuffer.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreact_utils.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreactnativeblob.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreactnativejni.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreactperfloggerjni.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libreanimated.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/librninstance.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/librnscreens.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/librrc_image.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/librrc_legacyviewmanagerinterop.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/librrc_view.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libruntimeexecutor.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libstatic-webp.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libturbomodulejsijni.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libuimanagerjni.so: 4096 Page Size of android/app/build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libyoga.so: 4096
(Of course, one can manually check the page size of each shared object using the
readelf -Wl
command.)I think React-Native should support the 16KB page size for the future.
[1] https://developer.android.com/guide/practices/page-sizes
[2] https://android-developers.googleblog.com/2024/05/the-second-beta-of-android-15.html
[3] https://issuetracker.google.com/issues/346830813#comment3
Steps to reproduce
npx react-native init
.npx expo run:android
.React Native Version
0.74.2
Affected Platforms
Runtime - Android
Output of
npx react-native info
Stacktrace or Logs
Reproducer
npx create-expo-app@latest
Screenshots and Videos
The text was updated successfully, but these errors were encountered: