Skip to content

Android:  libalphaskiajni.so  not compatible with 16 KB page size (Google Play requirement) #68

Closed

Description

@AndreiGorelov

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

On Android, the native library  libalphaskiajni.so  shipped with the alphaTab Android AAR is built with 4 KB LOAD section alignment.
When analyzing my APK / AAB in Android Studio (APK Analyzer / App Bundle Explorer), the following warnings are shown for alphaTab’s native libraries:
•  lib/x86_64/libalphaskiajni.so  – “4 KB LOAD section alignment, but 16 KB is required”
•  lib/arm64-v8a/libalphaskiajni.so  – “4 KB LOAD section alignment, but 16 KB is required”
Other native libraries in the same app are already aligned for 16 KB, but the alphaTab library is not, so the app as a whole is reported as not supporting 16 KB devices.

Image

According to Google Play’s new requirements, this will eventually prevent publishing updates for apps that include such libraries on devices with 16 KB page size (Android 16+).

Expected Behavior

alphaTab’s Android artifacts should ship native libraries ( libalphaskiajni.so ) that:
• are compatible with 16 KB page size; and
• pass Android Studio / Google Play checks without “4 KB LOAD section alignment” warnings, so apps using alphaTab can be published/updated for devices with 16 KB page size.

Steps To Reproduce

  1. Create a simple Android app that depends on alphaTab
    implementation("net.alphatab:alphaTab:1.8.1")
  2. Build an APK (debug or release)
  3. Open the built artifact in Android Studio: Build → Analyze APK
  4. Inspect the  lib/arm64-v8a  and  lib/x86_64  folders
  5. Observe the warnings on  libalphaskiajni.so: “4 KB LOAD section alignment, but 16 KB is required”

Link to jsFiddle, CodePen, Project

No response

Version and Environment

alphaTab version: 1.8.1 (net.alphatab:alphaTab from Maven Central)
Platform: Android 16
ABIs: arm64-v8a ,  x86_64 
Tools: Android Studio (APK Analyzer)

Platform

Android (Native)

Anything else?

I’m happy to test any changes or snapshot builds you provide to verify that the updated native libraries work correctly on devices with 16 KB page size and pass the Play/Android Studio checks, and I can report back with results.
Thanks a lot for your work on alphaTab!

Activity

  1. AndreiGorelov commented on Mar 23, 2026

    @AndreiGorelov
    Author

    Hi! I was able to build alphaSkia’s Android binaries with 16 KB page size support by modifying alphaSkia/externals/skia/gn/skia/BUILD.gn, specifically, the config("default") block:

    • Before:
      if (is_android) {
        cflags += [ "--sysroot=$ndk/toolchains/llvm/prebuilt/$ndk_host/sysroot" ]
        ldflags += [ "-static-libstdc++" ]
      }
    
    • Now:
      if (is_android) {
        cflags += [ "--sysroot=$ndk/toolchains/llvm/prebuilt/$ndk_host/sysroot" ]
        ldflags += [ "-static-libstdc++" ,
          # Align native libraries for 16 KB page size systems.
          # See https://source.android.com/docs/core/architecture/16kb-page-size/16kb
          "-Wl,-z,max-page-size=16384" ]
      }
    

    With this change I now get 16 KB–compatible libalphaskiajni.so for Android ABIs  arm64-v8a, x86_64, x86 and armeabi-v7a .
    However, this lives in the external repo, so I’m not sure if this is the best place to apply the fix for alphaSkia itself. Maybe you could integrate a similar linker flag into your build pipeline, or add your own patch layer on top of Skia, depending on how you prefer to manage third‑party deps.

  2. Danielku15 commented on Mar 27, 2026

    @Danielku15
    Member

    I did a small check. the newest NDK should normally automatically handle the alignment. Upgrading the NDK and taking the chance to upgrade to the latest Skia mgiht already fix the problem.

    I'd expect Skia to have the alignment somehow covered for targeting Android.

  3. AndreiGorelov commented on Mar 27, 2026

    @AndreiGorelov
    Author

    You are right. I double-checked this with NDK version 29.0.13846066 and can confirm that no manual fixes are required — simply rebuilding the binaries with the current NDK is sufficient. My earlier patch adding the -Wl,-z,max-page-size=16384 flag turned out to be unnecessary.

    From my observations:

    • With that NDK version, 64-bit binaries (x64, arm64) are built with 16 KB alignment, and 32-bit ones (x86, arm) with 4 KB, which makes sense. However, APK Analyzer incorrectly reports 16 KB alignment for the 32-bit binaries as well, even though that’s not actually the case.
    • Forcing the -Wl,-z,max-page-size=16384 flag makes 32-bit binaries also use 16 KB alignment, which is probably not desirable.
  4. Danielku15 commented on Mar 28, 2026

    @Danielku15
    Member

    It's strange that APK Analyzer reports a 16KB alignment need, from a quick research this is not required (also doesn't make much sense😁 ).

  5. Danielku15 commented on Mar 28, 2026

    @Danielku15
    Member

    Try upgrading v3.5.147 to in your project and let me know if things work out for you. In #69 I upgraded to Skia m147 and ensured we use the latest NDK r29. I added a check in the pipeline to ensure the correct page sizes.

  6. AndreiGorelov commented on Mar 28, 2026

    @AndreiGorelov
    Author

    I can confirm that with implementation("net.alphatab:alphaSkia-android:3.5.147") the alignment is correct (actually 32-bit binaries have 4 KB alignment).

    Image

    Thank you very much!

  7. AndreiGorelov commented on Apr 10, 2026

    @AndreiGorelov
    Author

    When using the alphaTab 1.8.2 release, the issue has reappeared.

  8. Danielku15 commented on Apr 10, 2026

    @Danielku15
    Member

    alphaTab 1.8.2 does not upgrade alphaSkia references. you need to consume latest alphaSkia in your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Area

None yet

Platform

None yet

Work State

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions