Android-database-sqlcipher3.5.9 to sqlcipher-android 4.5.5

I have made changes to migrate
implementation ‘net.zetetic:android-database-sqlcipher:3.5.9’ to
implementation ‘net.zetetic:sqlcipher-android:4.5.5’
implementation ‘androidx.sqlite:sqlite:2.2.0’

and followed below link for migration
https://www.zetetic.net/sqlcipher/sqlcipher-for-android-migration/

My helper class extends SQLiteOpenHelper

public SQLiteDatabase getDatabase() {
if(database == null){
System.loadLibrary(“sqlcipher”);
database = getWritableDatabase();
}
return database;
}

whenever I install apk with the changes
at getWritableDatabase() crash occurs

Failed to open database ‘/data/user/0/com.ticketleap.android.checkinapp/databases/ticketleap_app’.
android.database.sqlite.SQLiteException: file is not a database (code 26): , while compiling: PRAGMA journal_mode
at net.zetetic.database.sqlcipher.SQLiteConnection.nativePrepareStatement(Native Method)
at net.zetetic.database.sqlcipher.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:973)
at net.zetetic.database.sqlcipher.SQLiteConnection.executeForString(SQLiteConnection.java:671)
at net.zetetic.database.sqlcipher.SQLiteConnection.setJournalMode(SQLiteConnection.java:350)
at net.zetetic.database.sqlcipher.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:324)
at net.zetetic.database.sqlcipher.SQLiteConnection.open(SQLiteConnection.java:246)
at net.zetetic.database.sqlcipher.SQLiteConnection.open(SQLiteConnection.java:202)
at net.zetetic.database.sqlcipher.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:474)
at net.zetetic.database.sqlcipher.SQLiteConnectionPool.open(SQLiteConnectionPool.java:189)
at net.zetetic.database.sqlcipher.SQLiteConnectionPool.open(SQLiteConnectionPool.java:181)
at net.zetetic.database.sqlcipher.SQLiteDatabase.openInner(SQLiteDatabase.java:1028)
at net.zetetic.database.sqlcipher.SQLiteDatabase.open(SQLiteDatabase.java:1013)
at net.zetetic.database.sqlcipher.SQLiteDatabase.openDatabase(SQLiteDatabase.java:840)
at net.zetetic.database.sqlcipher.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:359)
at net.zetetic.database.sqlcipher.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:278)
at com.ticketleap.android.common.services.DatabaseHelper.getDatabase(DatabaseHelper.java:92)
at com.ticketleap.android.common.services.DatabaseHelper.clearTables(DatabaseHelper.java:98)
at com.ticketleap.android.common.services.DatabaseHelper$StoreUserTicketListTask.doInBackground(DatabaseHelper.java:114)
at com.ticketleap.android.common.services.DatabaseHelper$StoreUserTicketListTask.doInBackground(DatabaseHelper.java:108)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)

Hi @Anshuman_Biswal,

If you are also upgrading from SQLCipher 3.x to SQLCipher 4.x, regardless of the client library used, you will need to review the upgrade guidance for SQLCipher 4 as SQLCipher 4 will not open older databases by default.

Hi Zetatic Team,

Even we faced same issue when we recently migrated our Sqlcipher from version 3.5.9 to 4.5.4.

Strange thing is that we are unable to reproduce and only happening to the production users in the background.

We did follow the PRGMA migration document and still seeing this.

Wanted to check if this would be solved if we move to latest Sqlcipher version 4.6.0?

Hi @Abbagouni,

If you can reproduce the issue in a small reproduction application in isolation we would be happy to look into it further.