davidmartos96/sqflite_sqlcipher

java.lang.ClassNotFoundException: Didn't find class "net.sqlcipher.SQLException" on path

rnik12 opened this issue · 7 comments

rnik12 commented

E/AndroidRuntime(20870): java.lang.NoClassDefFoundError: Failed resolution of: Lnet/sqlcipher/SQLException;
E/AndroidRuntime(20870): at com.davidmartos96.sqflite_sqlcipher.SqfliteSqlCipherPlugin.handleException(SqfliteSqlCipherPlugin.java:627)
E/AndroidRuntime(20870): at com.davidmartos96.sqflite_sqlcipher.SqfliteSqlCipherPlugin.query(SqfliteSqlCipherPlugin.java:508)
E/AndroidRuntime(20870): at com.davidmartos96.sqflite_sqlcipher.SqfliteSqlCipherPlugin.access$100(SqfliteSqlCipherPlugin.java:72)
E/AndroidRuntime(20870): at com.davidmartos96.sqflite_sqlcipher.SqfliteSqlCipherPlugin$1.run(SqfliteSqlCipherPlugin.java:298)
E/AndroidRuntime(20870): at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime(20870): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(20870): at android.os.Looper.loopOnce(Looper.java:226)
E/AndroidRuntime(20870): at android.os.Looper.loop(Looper.java:313)
E/AndroidRuntime(20870): at android.os.HandlerThread.run(HandlerThread.java:67)
E/AndroidRuntime(20870): Caused by: java.lang.ClassNotFoundException: Didn't find class "net.sqlcipher.SQLException" on path: DexPathList[[zip file "/data/app/~~we74lhxEpsLGpmM9pwslow

rnik12 commented

I think might be related to Sqlcipher 4.5.4 release

sqlcipher/android-database-sqlcipher#588 (comment)

rnik12 commented

Already there.

proguard-rules.pro

-keep class net.sqlcipher.** { *; }

Also added below as per https://www.zetetic.net/sqlcipher/sqlcipher-for-android/

build.gradle

allprojects {
    repositories {
        google()
        mavenCentral()
        flatDir {
            dirs 'app/libs'
        }
    }
}

Error persists. You can try raising SQLException. I was searching FTS5 table with query "test-*"

@rnik12 Are you using version 4.5.4?
This plugin installs version 4.5.0 on Android.

You can check the version by running the following query in your app: PRAGMA cipher_version

I'm getting the same error. This is part of the error:

No pending exception expected: java.lang.NoSuchFieldError: no "J" field "mNativeHandle" in class "Lnet/sqlcipher/database/SQLiteDatabase;" or its superclasses
F/app.bibleram(15235): thread.cc:2489]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class) (Runtime.java:-2)
F/app.bibleram(15235): thread.cc:2489]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1121)
F/app.bibleram(15235): thread.cc:2489]   at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.Class, java.lang.String) (Runtime.java:1075)
F/app.bibleram(15235): thread.cc:2489]   at void java.lang.Runtime.loadLibrary0(java.lang.Class, java.lang.String) (Runtime.java:998)
F/app.bibleram(15235): thread.cc:2489]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:1661)
F/app.bibleram(15235): thread.cc:2489]   at void net.sqlcipher.database.SQLiteDatabase$a.a(java.lang.String[]) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at void net.sqlcipher.database.SQLiteDatabase.x(android.content.Context, java.io.File, net.sqlcipher.database.SQLiteDatabase$e) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at void net.sqlcipher.database.SQLiteDatabase.w(android.content.Context, java.io.File) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at void net.sqlcipher.database.SQLiteDatabase.v(android.content.Context) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at void p0.c.z(android.content.Context, s2.c) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at void p0.c.onAttachedToEngine(j2.a$b) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at void io.flutter.embedding.engine.c.g(j2.a) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at void io.flutter.plugins.GeneratedPluginRegistrant.registerWith(io.flutter.embedding.engine.a) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
F/app.bibleram(15235): thread.cc:2489]   at void p2.a.a(io.flutter.embedding.engine.a) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at void io.flutter.embedding.android.d.D(io.flutter.embedding.engine.a) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at void io.flutter.embedding.android.e.q(android.content.Context) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at void io.flutter.embedding.android.d.onCreate(android.os.Bundle) (SourceFile:-1)
F/app.bibleram(15235): thread.cc:2489]   at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:8057)
F/app.bibleram(15235): thread.cc:2489]   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:8037)
F/app.bibleram(15235): thread.cc:2489]   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1341)
F/app.bibleram(15235): thread.cc:2489]   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:3688)
F/app.bibleram(15235): thread.cc:2489]   at android.app.Activity android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.app.servertransaction.PendingTransactionActions, android.content.Intent) (ActivityThread.java:3864)
F/app.bibleram(15235): thread.cc:2489]   at void android.app.servertransaction.LaunchActivityItem.execute(android.app.ClientTransactionHandler, android.os.IBinder, android.app.servertransaction.PendingTransactionActions) (LaunchActivityItem.java:103)
F/app.bibleram(15235): thread.cc:2489]   at void android.app.servertransaction.TransactionExecutor.executeCallbacks(android.app.servertransaction.ClientTransaction) (TransactionExecutor.java:135)
F/app.bibleram(15235): thread.cc:2489]   at void android.app.servertransaction.TransactionExecutor.execute(android.app.servertransaction.ClientTransaction) (TransactionExecutor.java:95)
F/app.bibleram(15235): thread.cc:2489]   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:2253)
F/app.bibleram(15235): thread.cc:2489]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
F/app.bibleram(15235): thread.cc:2489]   at boolean android.os.Looper.loopOnce(android.os.Looper, long, int) (Looper.java:201)
F/app.bibleram(15235): thread.cc:2489]   at void android.os.Looper.loop() (Looper.java:288)
F/app.bibleram(15235): thread.cc:2489]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7870)
F/app.bibleram(15235): thread.cc:2489]   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
F/app.bibleram(15235): thread.cc:2489]   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:548)
F/app.bibleram(15235): thread.cc:2489]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1003)

This is going to sound so dumb. But I named my proguard file proguard-rules.prop instead of proguard-rules.pro

Nevermind my issues are solved.