@Database(entities = [Account::class, SMS::class], version = 4, exportSchema = false)
abstract class AppDatabase : RoomDatabase() {
abstract fun accountDao(): AccountDao
abstract fun smsDao(): SMSDao
companion object {
fun getInstance(context: Context): AppDatabase {
System.loadLibrary("sqlcipher")
val passphrase = EncryptedPrefs(context).getDBKey()
val databaseFile = context.getDatabasePath("system.db")
val factory = SupportOpenHelperFactory(passphrase?.toByteArray(StandardCharsets.UTF_8))
val db = databaseBuilder(context, AppDatabase::class.java, databaseFile.absolutePath)
.openHelperFactory(factory)
.build()
return db
}
}
}
I get this error in any call to it:
java.lang.NullPointerException
at androidx.room.Room.getGeneratedImplementation(Room.kt:42)
at androidx.room.RoomDatabase$Builder.build(RoomDatabase.kt:1347)
at AppDatabase$Companion.getInstance(AppDatabase.kt:28)
I tried with the latest versions of room and sqlite and also the versions in the test in this repo but it is the same error:
I am implementing the following Db class:
I get this error in any call to it:
I tried with the latest versions of room and sqlite and also the versions in the test in this repo but it is the same error: