SQLCipher for Android version:
v3.5.8
Previously we used v3.4.0, however, since Google has announced a security update for next August 2018, we are trying to migrate as soon as possible to targetSDK 26, and this version wasn’t supporting Android N, therefore we thought moving to 3.5.8 is the right decision. However this version crashes after setting up sqlcipher for Android and trying to be loaded from a static initialiser. Read the following:
Expected Behavior
Latest version 3.5.8 used by means of the compiled file libsqlcipher.so from Native land should work normally when loading its .so file at the Android land.
Actual Behavior
Crashes with crash:
12-28 12:17:42.139 10121-10156/? A/zygote: thread.cc:2090] No pending exception expected: java.lang.ClassNotFoundException: Didn't find class "net.sqlcipher.database.SQLiteDatabase" on path: DexPathList[[zip file "/data/app/com.xxx.xxxx-5spNAiLRX4TIB7jBRnwGkA==/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.xxxx-5spNAiLRX4TIB7jBRnwGkA==/lib/arm, /data/app/xxx.xxx.xxx-5spNAiLRX4TIB7jBRnwGkA==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
Steps to Reproduce
The library is required at our project to be used as a .so file since it’s used by other libraries like odb 2.4.
Proguard was used as suggested at a previous issue like:
-keep class net.sqlcipher.** { *; }
but both with and without proguard this doesn’t work. Proguard is at the build.gradle from the app, buildType release
Android.mk has included
LOCAL_SHARED_LIBRARIES += sqlcipher
with the reference to that file:
LOCAL_MODULE := sqlcipher LOCAL_SRC_FILES := $(ROOT_PATH)/../../android-database-sqlcipher/android-database-sqlcipher/src/main/libs/$(TARGET_ARCH_ABI)/sqlcipher.so
and loads it by means of:
static { System.loadLibrary("c++_shared"); System.loadLibrary("sqlcipher"); }
The Android project launches the app, and tries to load this sqlciphe_android.so file, and fails crashing.