sqlcipher/android-database-sqlcipher

android.database.sqlite.SQLiteException: SQL logic error: , while compiling: select count(*) from sqlite_master;

Android1500 opened this issue · 1 comments

After adding factory to room db i got this error i am not sure why i getting error
even i tried :-

`private fun getSupportFactory(): SupportFactory {
val passPhrase: ByteArray = SQLiteDatabase.getBytes(passphrase.toCharArray())
val hook = object : SQLiteDatabaseHook {
override fun preKey(database: SQLiteDatabase?) {}

    override fun postKey(database: SQLiteDatabase?) {
        database?.rawExecSQL("PRAGMA key = '$passPhrase';")
        database?.rawExecSQL("PRAGMA cipher_migrate;")
    }
}
return SupportFactory(passPhrase, hook)

}`

room builder :-
fun getRoomDatabase(context: Context) = Room.databaseBuilder( context, AndroidFakerRoomDatabase::class.java, DATABASE_NAME ).openHelperFactory(getSupportFactory()) .createFromAsset("databases/database.db") .build()

After some research i found that its cause of using createFromAsset()