I'm trying to set up Safe-room lib in my project but I got a mysterious error.
For this example, I'm using todo-mvp by Google, so they're using Dagger2 and RxJava.
in TodoDatabase.class I have the bunch of code:
fun getInstance(context: Context): ToDoDatabase {
synchronized(lock) {
if (INSTANCE == null) {
val admin = "password123".toCharArray()
val factory = SafeHelperFactory(admin)
INSTANCE = Room.databaseBuilder(context.applicationContext, ToDoDatabase::class.java, "Tasks.db")
.openHelperFactory(factory)
.build()
SQLCipherUtils.encrypt(context, "Tasks.db", admin)
val state = SQLCipherUtils.getDatabaseState(context, "Tasks.db")
if (state.name == SQLCipherUtils.State.ENCRYPTED.name)
Log.e("test", "Database encrypted - $state")
else
Log.e("test", "Database encrypted - $state")
}
return INSTANCE!!
}
}
After executing this line INSTANCE = Room.databaseBuilder(context.applicationContext, ToDoDatabase::class.java, "Tasks.db").openHelperFactory(factory).build()
I caught the error:
E/art: Failed to register native method net.sqlcipher.database.SQLiteDatabase.native_getDbLookaside()I in /data/app/com.example.android.architecture.blueprints.todomvp.mock-1/split_lib_dependencies_apk.apk:classes5.dex
----- class 'Lnet/sqlcipher/database/SQLiteDatabase;' cl=0x12c81280 -----
objectSize=1096 (128 from super)