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
Error 26 generally means that the database can’t be opened due to encryption key mismatch or lack of encryption support. Here are a few specific reasons:
- The encryption keys do not match. Please verify that the same key value us used every time the application is opening the database.
- SQLCipher is not actually being used - to verify this, in your application code execute the statement
PRAGMA cipher_version
and check the result set. Verify that a version is being returned. If you don’t get a result set then SQLCipher is not actually be used at runtime.
- Major versions don’t match, i.e. opening a SQLCipher 3 database with SQLCipher 4.
- Opening an unencrypted database with a key - How to encrypt a plaintext SQLite database to use SQLCipher (and avoid “file is encrypted or is not a database” errors)