Version 4.5.0 not woking on some phones

net.zetetic:android-database-sqlcipher:4.5.0 not working on some phones giving below error on this line:
System.loadLibrary(“sqlcipher”);

Below is the Error:
JNI DETECTED ERROR IN APPLICATION: JNI FindClass called with pending exception java.lang.NoSuchFieldError: no “I” field “mNativeHandle” in class “Lnet/sqlcipher/database/SQLiteDatabase;” or its superclasses
java_vm_ext.cc:594] at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class) (Runtime.java:-2)
java_vm_ext.cc:594] at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1121)
java_vm_ext.cc:594] at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.Class, java.lang.String) (Runtime.java:1075)
java_vm_ext.cc:594] at void java.lang.Runtime.loadLibrary0(java.lang.Class, java.lang.String) (Runtime.java:998)
java_vm_ext.cc:594] at void java.lang.System.loadLibrary(java.lang.String) (System.java:1661)
java_vm_ext.cc:594] at void net.sqlcipher.database.SQLiteDatabase$1.loadLibraries(java.lang.String) (SQLiteDatabase.java:227)
java_vm_ext.cc:594] at void net.sqlcipher.database.SQLiteDatabase.loadLibs(android.content.Context, java.io.File, net.sqlcipher.database.SQLiteDatabase$LibraryLoader) (SQLiteDatabase.java:244)
java_vm_ext.cc:594] at void net.sqlcipher.database.SQLiteDatabase.loadLibs(android.content.Context, java.io.File) (SQLiteDatabase.java:223)
java_vm_ext.cc:594] at void net.sqlcipher.database.SQLiteDatabase.loadLibs(android.content.Context) (SQLiteDatabase.java:216)
java_vm_ext.cc:594]

Project Cofiguration
Targeting sdk 31
ndkVersion ‘21.1.6352462’
Java version 8
abiFilters “armeabi”, “armeabi-v7a”,‘arm64-v8a’, ‘x86_64’

Build.gradle (project Level):
buildscript {
repositories {
google()
jcenter()
maven {
url ‘https://maven.google.com/
name ‘Google’
}
maven {
url ‘https://jitpack.io
}

}
dependencies {
    classpath 'com.android.tools.build:gradle:4.1.2'
    classpath 'com.google.gms:google-services:4.1.0'
}

}

allprojects {
repositories {
google()
jcenter()
maven {
url ‘https://maven.google.com/
name ‘Google’
}
maven {
url ‘https://jitpack.io
}

}

}

Some listed devices are below:
Samsung Galaxy M13
Samsung Galaxy M11
Samsung J7 Prime

Hi @Bhagyashree_Patil,

Are you using ProGuard within your application? If so, would you disable it, rebuild, and test on the affected devices?

Even after disabling proguard it is not working

Hi @Bhagyashree_Patil,

Would you use apktool to inspect your compiled package and verify whether libsqlcipher.so is being properly bundled within your build for all target platforms?

Is this still an issue? I am about to migrate from android sqlcipher legacy (which is causing a crash on some devices) to 4.5.3. I don’t want to jump out of the frying pan and into the fire…

Hi @Redrazors,

We are not aware of any issues with either the legacy or current sqlcipher-android library regarding device limitations as mentioned above. The error reported above is typically due to some level of post-processing of a build, often times ProGuard is the cause. Please let us know if you run into any issues.

1 Like