Skip to content

16 KB Support Android #3134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task
a-klotz-p8 opened this issue May 8, 2025 · 3 comments
Open
1 task

16 KB Support Android #3134

a-klotz-p8 opened this issue May 8, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@a-klotz-p8
Copy link

Description

I am in the process of releasing my APP to production. Now in the Google Play Console I got the warning that some libraries are not 16 KB aligned. This seems to include SKIA.
I already tried using a ndk >= 28 in my android/build.gradle as well as adding the following to my android/app/build.gradle:

externalNativeBuild { // For ndk-build, instead use the ndkBuild block. cmake { // Passes optional arguments to CMake. arguments "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON" } }

Expected behavior:
librnskia.so should be aligned and compatible with 16 KB page-size environments.

Actual behavior:
check_elf_alignment.sh flags librnskia.so as unaligned.

Relevant documentation:
Android docs on flexible page size support

Request:
Could you please verify if Skia is being built with the correct alignment flags?
Is there any additional configuration needed with Skia or am I doing something wrong?

React Native Skia Version

2.0.0-next.1

React Native Version

0.78.0

Using New Architecture

  • Enabled

Steps to Reproduce

  1. create a new react native app
  2. add react-native-skia
  3. generate apk
  4. analyze the apk using this
  5. librnskia.so should be listed as UNALIGNED

Snack, Code Example, Screenshot, or Link to Repository

Don't have a reproducer yet but can create one if needed.

@a-klotz-p8 a-klotz-p8 added the bug Something isn't working label May 8, 2025
@lennyerik
Copy link

As a workaround, you can add

# Enable Android 16kb native library alignment
target_link_options(${PACKAGE_NAME} PRIVATE "-Wl,-z,max-page-size=16384")

to node_modules/@shopify/react-native-skia/android/CMakeLists.txt.
After rebuilding, check_elf_alignment.sh shows aligned for librnskia.so as well.

I'm also working on a PR to fix this issue.

@wcandillon
Copy link
Contributor

so no change are needed to the skia prebuilt binaries? just librnskia.so needs to be 16byte aligned?

@lennyerik
Copy link

According to the check_elf_alignment.sh script and the emulator image, which usually throws a warning if a library is unaligned, this seems to be the only change to build with 16 KB page size support enabled.
When I get the time, I'll also run the end-to-end tests in the 16 KB emulator image to verify that everything is working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants