I’m upgrading an app from the legacy android library to the new one, that uses proguard.
We replaced proguard rules:
# sqlcipher
-keep class net.sqlcipher.** { *; }
-keep class net.sqlcipher.database.* { *; }
with
keep class net.zetetic.database.** { *; }
-keep class net.zetetic.database.sqlcipher.** { *; }
We’ve also added System.loadLibrary("sqlcipher")
in our Application.onCreate()
This works fine, and dbs are encrypted normally in our debug builds, however in our minified/proguarded release builds, we are getting crashes:
Fatal Exception: java.lang.UnsatisfiedLinkError: No implementation found for long net.zetetic.database.sqlcipher.SQLiteConnection.nativeOpen(java.lang.String, int, java.lang.String, boolean, boolean) (tried Java_net_zetetic_database_sqlcipher_SQLiteConnection_nativeOpen and Java_net_zetetic_database_sqlcipher_SQLiteConnection_nativeOpen__Ljava_lang_String_2ILjava_lang_String_2ZZ) - is the library loaded, e.g. System.loadLibrary?
at net.zetetic.database.sqlcipher.SQLiteConnection.nativeOpen(SourceFile)
at net.zetetic.database.sqlcipher.SQLiteConnection.open(SourceFile:5)
at net.zetetic.database.sqlcipher.SQLiteConnection.open(SourceFile:2)
at net.zetetic.database.sqlcipher.SQLiteConnectionPool.openConnectionLocked(:6)
at net.zetetic.database.sqlcipher.SQLiteConnectionPool.open(SourceFile:4)
at net.zetetic.database.sqlcipher.SQLiteConnectionPool.open(SourceFile:2)
at net.zetetic.database.sqlcipher.SQLiteDatabase.openInner(:5)
at net.zetetic.database.sqlcipher.SQLiteDatabase.open()
at net.zetetic.database.sqlcipher.SQLiteDatabase.openDatabase(SourceFile:7)
at net.zetetic.database.sqlcipher.SQLiteOpenHelper.getDatabaseLocked(:131)
at net.zetetic.database.sqlcipher.SQLiteOpenHelper.getWritableDatabase(SourceFile:3)
at net.zetetic.database.sqlcipher.SupportHelper.getWritableDatabase(:2)
at androidx.room.f0.z(:4)
at androidx.room.f0.d()
at androidx.room.f0.K(:8)
at th.a.y1(:11)
at com.core.datastore.cad.dao.p$e.a(:9)
at com.core.datastore.cad.dao.p$e.call()
at androidx.room.i.invokeSuspend(:9)
at cn.a.resumeWith(:7)
at tn.j0.run(:113)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Is there something missing from our proguard config?