1
+ < meta charset ="utf-8 ">
2
+ (#) Native library dependency not 16 KB aligned
3
+
4
+ !!! WARNING: Native library dependency not 16 KB aligned
5
+ This is a warning.
6
+
7
+ Id
8
+ : `Aligned16KB`
9
+ Summary
10
+ : Native library dependency not 16 KB aligned
11
+ Severity
12
+ : Warning
13
+ Category
14
+ : Correctness
15
+ Platform
16
+ : Android
17
+ Vendor
18
+ : Android Open Source Project
19
+ Feedback
20
+ : https://issuetracker.google.com/issues/new?component=192708
21
+ Affects
22
+ : Gradle build files and TOML files
23
+ Editing
24
+ : This check can *not* run live in the IDE editor
25
+ See
26
+ : https://developer.android.com/guide/practices/page-sizes
27
+ Implementation
28
+ : [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)
29
+ Tests
30
+ : [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)
31
+ Copyright Year
32
+ : 2025
33
+
34
+ Historically, Android has aligned memory using 4 KB memory page sizes,
35
+ which optimized system memory performance for the average amount of
36
+ total memory that Android devices have typically had.
37
+
38
+ To support devices that only support 16 KB aligned libraries in the
39
+ future, the Google Play Store will soon require all apps to be compiled
40
+ with 16 KB aligned libraries.
41
+
42
+ An app compiled with 4 KB aligned libraries will not work correctly on
43
+ these devices. To ensure compatibility with these devices and to
44
+ future-proof your app, the Play Store will require native libraries to
45
+ be aligned to 16 KB boundaries.
46
+
47
+ If your app uses any NDK libraries, either directly or indirectly
48
+ through an SDK, you'll need to rebuild your app to meet this new
49
+ requirement. This means ensuring that all native libraries within your
50
+ app, including those from any dependencies, are built with 16 KB page
51
+ alignment.
52
+
53
+ This lint check helps identify potential issues by inspecting all
54
+ transitive libraries your app depends on. If any nested native libraries
55
+ are found to be aligned only to 4 KB, you'll need to take action.
56
+
57
+ If lint flags a library, try updating to a newer version that supports
58
+ 16 KB alignment. If no updated version is available, reach out to the
59
+ library vendor for assistance.
60
+
61
+ (##) Example
62
+
63
+ Here is an example of lint warnings produced by this check:
64
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
65
+ build.gradle:2:Warning: The native library
66
+ arm64-v8a/libtensorflowlite_jni.so (from
67
+ org.tensorflow:tensorflow-lite:2.16.1) is not 16 KB aligned
68
+ [Aligned16KB]
69
+ implementation("org.tensorflow:tensorflow-lite:2.16.1")
70
+ ---------------------------------------
71
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72
+
73
+ Here are the relevant test files:
74
+
75
+ `build.gradle`:
76
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~groovy linenumbers
77
+ dependencies {
78
+ implementation("org.tensorflow:tensorflow-lite:2.16.1")
79
+ }
80
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81
+
82
+ [build/intermediates/exploded-aar/org.tensorflow/tensorflow-lite/2.16.1/jni/arm64-v8a/libtensorflowlite_jni.so](examples/arm64-v8a/libtensorflowlite_jni.so)
83
+
84
+ [build/intermediates/exploded-aar/org.tensorflow/tensorflow-lite/2.16.1/jni/x86_64/libtensorflowlite_jni.so](examples/x86_64/libtensorflowlite_jni.so)
85
+
86
+ [build/intermediates/exploded-aar/org.tensorflow/tensorflow-lite/2.16.1/jni/armeabi-v7a/libtensorflowlite_jni.so](examples/armeabi-v7a/libtensorflowlite_jni.so)
87
+
88
+ [build/intermediates/exploded-aar/org.tensorflow/tensorflow-lite/2.16.1/jni/x86/libtensorflowlite_jni.so](examples/x86/libtensorflowlite_jni.so)
89
+
90
+ You can also visit the
91
+ [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)
92
+ for the unit tests for this check to see additional scenarios.
93
+
94
+ (##) Suppressing
95
+
96
+ You can suppress false positives using one of the following mechanisms:
97
+
98
+ * Using a suppression comment like this on the line above:
99
+
100
+ ```kt
101
+ //noinspection Aligned16KB
102
+ problematicStatement()
103
+ ```
104
+
105
+ * Using a special `lint.xml` file in the source tree which turns off
106
+ the check in that folder and any sub folder. A simple file might look
107
+ like this:
108
+ ```xml
109
+ <?xml version="1.0" encoding="UTF-8"?>
110
+ <lint>
111
+ <issue id="Aligned16KB" severity="ignore" />
112
+ </lint>
113
+ ```
114
+ Instead of `ignore` you can also change the severity here, for
115
+ example from `error` to `warning`. You can find additional
116
+ documentation on how to filter issues by path, regular expression and
117
+ so on
118
+ [here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html).
119
+
120
+ * In Gradle projects, using the DSL syntax to configure lint. For
121
+ example, you can use something like
122
+ ```gradle
123
+ lintOptions {
124
+ disable 'Aligned16KB'
125
+ }
126
+ ```
127
+ In Android projects this should be nested inside an `android { }`
128
+ block.
129
+
130
+ * For manual invocations of `lint`, using the `--ignore` flag:
131
+ ```
132
+ $ lint --ignore Aligned16KB ...`
133
+ ```
134
+
135
+ * Last, but not least, using baselines, as discussed
136
+ [here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).
137
+
138
+ <!-- Markdeep: --> < style class ="fallback "> body {visibility : hidden;white-space : pre;font-family : monospace}</ style > < script src ="markdeep.min.js " charset ="utf-8 "> </ script > < script src ="https://morgan3d.github.io/markdeep/latest/markdeep.min.js " charset ="utf-8 "> </ script > < script > window . alreadyProcessedMarkdeep || ( document . body . style . visibility = "visible" ) </ script >
0 commit comments