Hay Team,
i am using :
**implementation ("net.zetetic:sqlcipher-android:4.6.0@aar")**
** implementation (“androidx.sqlite:sqlite:2.2.0”)**
if i running my app in my device samsung S10, my app crash and this error android.database.sqlite.SQLiteException: file is not a database (code 26): , while compiling: SELECT COUNT(*) FROM sqlite_schema; , but if i running in other divice or emulator, my app no crash and normal i useed, pliss help i stak because this bug, thanks
this my code :
abstract class QuranDatabase : RoomDatabase() {
abstract fun quranDataDao(): QuranDataDao
companion object {
@Volatile
private var INSTANCE: QuranDatabase? = null
private val base64EncodeDbKey: String = BuildConfig.BASE64_KEY_DB
fun getDatabase(context: Context): QuranDatabase {
return INSTANCE ?: synchronized(this) {
val passphrase = base64EncodeDbKey.toByteArray(Charsets.UTF_8)
val factory = SupportOpenHelperFactory(passphrase)
val instance = Room.databaseBuilder(
context.applicationContext,
QuranDatabase::class.java,
"quran_database"
)
.openHelperFactory(factory)
.createFromAsset("databases/iqra.db")
.build()
INSTANCE = instance
instance
}
}
}
}