(#) Native library dependency not 16 KB aligned !!! WARNING: Native library dependency not 16 KB aligned This is a warning. Id : `Aligned16KB` Summary : Native library dependency not 16 KB aligned Severity : Warning Category : Correctness Platform : Android Vendor : Android Open Source Project Feedback : https://issuetracker.google.com/issues/new?component=192708 Since : 8.10.0 (May 2025) Affects : Gradle build files and TOML files Editing : This check runs on the fly in the IDE editor See : https://developer.android.com/guide/practices/page-sizes Implementation : [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/PageAlignmentDetector.kt) Tests : [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/PageAlignmentDetectorTest.kt) Android has traditionally used 4 KB memory page sizes. However, to support future devices that only work with 16 KB aligned libraries apps containing native libraries need to be built with 16 KB alignment. Apps with 4 KB aligned native libraries may not work correctly on devices requiring 16 KB alignment. To ensure compatibility and future-proof your app, it is strongly recommended that your native libraries are aligned to 16 KB boundaries. If your app uses any NDK libraries, directly or indirectly through an SDK, you should rebuild your app to meet this recommendation. Make sure all native libraries within your application, including those from dependencies, are built with 16 KB page alignment. This lint check looks at all native libraries that your app depends on. If any are found to be aligned to 4 KB instead of 16 KB, you will need to address this. When a library is flagged, first try to update to a newer version that supports 16 KB alignment. If an updated version is not available, contact the library vendor to ask about their plans for 16 KB support and request a compatible version. Updating your libraries proactively will help ensure your app works properly on a wider range of devices. (##) Example Here is an example of lint warnings produced by this check: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text build.gradle:2:Warning: The native library arm64-v8a/libtensorflowlite_jni.so (from org.tensorflow:tensorflow-lite:2.16.1) is not 16 KB aligned [Aligned16KB] implementation("org.tensorflow:tensorflow-lite:2.16.1") --------------------------------------- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here are the relevant test files: `build.gradle`: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~groovy linenumbers dependencies { implementation("org.tensorflow:tensorflow-lite:2.16.1") } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [build/intermediates/exploded-aar/org.tensorflow/tensorflow-lite/2.16.1/jni/arm64-v8a/libtensorflowlite_jni.so](examples/arm64-v8a/libtensorflowlite_jni.so) [build/intermediates/exploded-aar/org.tensorflow/tensorflow-lite/2.16.1/jni/x86_64/libtensorflowlite_jni.so](examples/x86_64/libtensorflowlite_jni.so) [build/intermediates/exploded-aar/org.tensorflow/tensorflow-lite/2.16.1/jni/armeabi-v7a/libtensorflowlite_jni.so](examples/armeabi-v7a/libtensorflowlite_jni.so) [build/intermediates/exploded-aar/org.tensorflow/tensorflow-lite/2.16.1/jni/x86/libtensorflowlite_jni.so](examples/x86/libtensorflowlite_jni.so) You can also visit the [source code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/PageAlignmentDetectorTest.kt) for the unit tests for this check to see additional scenarios. (##) Suppressing You can suppress false positives using one of the following mechanisms: * Using a suppression comment like this on the line above: ```kt //noinspection Aligned16KB problematicStatement() ``` * Using a special `lint.xml` file in the source tree which turns off the check in that folder and any sub folder. A simple file might look like this: ```xml <?xml version="1.0" encoding="UTF-8"?> <lint> <issue id="Aligned16KB" severity="ignore" /> </lint> ``` Instead of `ignore` you can also change the severity here, for example from `error` to `warning`. You can find additional documentation on how to filter issues by path, regular expression and so on [here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html). * In Gradle projects, using the DSL syntax to configure lint. For example, you can use something like ```gradle lintOptions { disable 'Aligned16KB' } ``` In Android projects this should be nested inside an `android { }` block. * For manual invocations of `lint`, using the `--ignore` flag: ``` $ lint --ignore Aligned16KB ...` ``` * Last, but not least, using baselines, as discussed [here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).