SQLCipher for Android - Native Library Support

Note: SQLCipher for Android now includes support for both 32-bit and 64-bit platforms. This post will remain as the reference to ABI splits may be helpful to some users.


SQLCipher for Android currently includes support for armeabi, armeabi-v7a, and x86 only. At this time we do not include support for either arm64, or x86_64 as OpenSSL does not currently build on those platforms without modification of the standard OpenSSL build system. We currently expect OpenSSL to include support for arm64 and x86_64 with the 1.1.0 release, which is not yet available.

SQLCipher for Android will still run on Android devices that have 64 bit CPU’s, however if you are using other third-party libraries that include native libraries that include either arm64, or x86_64, you may receive an error message like below:

Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/xxx/base.apk"],nativeLibraryDirectories=[/data/app/xxx/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libstlport_shared.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:989)
at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:173)
at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:169)

Due to Android’s preferential loading process, if, for example, your APK is including other third-party libraries that contain native libraries that target architectures other than armeabi, armeabi-v7a, or x86, Android will attempt to load all native libraries from within the folder that is the closest match for its platform architecture, thus causing the error above when it attempts to locate SQLCipher for Android within a 64 bit platform folder.

This issue can be addressed by removing any included native libraries for architectures other than armeabi, armeabi-v7a, and x86; this allows the Android device to load the 32 bit version of all libraries, even on a 64 bit device. For gradle users, you can utilize the ABI split feature.

3 Likes