Skip to content

Enhancement: Support 16 KB page alignment for native libraries #662

@meashishpatel

Description

@meashishpatel

Expected Behavior

The pre-compiled native library libsqlcipher.so should be built with support for 16 KB page alignment. This would allow apps using SQLCipher to take full advantage of modern performance optimizations on newer 64-bit Android devices, and it would resolve build warnings in Android Studio.

Actual Behavior

When building an Android application with the recommended setting android:extractNativeLibs="false", the build process generates a warning:

The native library arm64-v8a/libsqlcipher.so (from net.zetetic:android-database-sqlcipher:4.5.4) is not 16 KB aligned

This indicates the native library was not compiled with the necessary linker flag (-Wl,-z,max-page-size=16384). As a result, the Android OS has to fall back to using less efficient 4 KB memory pages for this library, negating some of the performance benefits.

For more context, please see the official Android documentation on this feature: [16 KB page compatibility](https://www.google.com/search?q=https://developer.android.com/topic/performance/reduce-apk-size%2316kb-page-compat).

Steps to Reproduce

  1. Create a standard Android project in Android Studio.
  2. Add net.zetetic:android-database-sqlcipher:4.5.4 (or the latest version) as a dependency in the build.gradle file.
  3. In the app/src/main/AndroidManifest.xml file, add android:extractNativeLibs="false" to the <application> tag.
  4. Build the application.
  5. Observe the "Android 16 KB Alignment" warning in the build output window.

SQLCipher version (can be identified by executing PRAGMA cipher_version;):

4.5.4

SQLCipher for Android version:

4.5.4 (This issue is also present in the latest version, 4.5.5, as of September 2025).

Are you able to reproduce this issue within the SQLCipher for Android [test suite](https://github.com/sqlcipher/sqlcipher-android-tests)?

This issue is related to the build configuration and linker flags used to compile the native .so binary, not its runtime behavior. Therefore, it is observable during the application packaging process and via static APK analysis, which is outside the scope of the runtime test suite.

Note: Thank you for maintaining this essential library. Adding support for this would be a great enhancement for modern Android app performance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions