Skip to content

[Platform] [Android] .so jni libraries are not 16kb load section aligned #39871

Description

@AkochDev

Reproduction steps

When creating an APK for Android the Android Studio complaints about 16KB alignment.

Image Image

I haven't been able to find out where to make the changes described in https://developer.android.com/guide/practices/page-sizes to recompile the .so with the proper 16kb alignment.

Would you please point out where can I add this configuration change so the .so gets the proper 16kb alignment ?
The docs suggest to:
Move to an AGP version 8.5.1 or higher and/or
Update your Android.mk to enable 16 KB ELF alignment adding:
LOCAL_LDFLAGS += "-Wl,-z,max-page-size=16384"

Thanks.

Platform

android

Platform Version(s)

15+

Type

Manually tested with SDK

(Optional) If manually tested please explain why this is only manually tested

Analyzing the .apk with the Android Studio is the easier way to check why the .apk is not 16kb aligned

Anything else?

Android docs https://developer.android.com/guide/practices/page-sizes

Metadata

Metadata

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions