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

**URL:** <https://discuss.zetetic.net/t/android-database-sqlcipher3-5-9-to-sqlcipher-android-4-5-5/6366>\
**Category:** SQLCipher\
**Created:** [April 2, 2024, 5:23pm UTC](https://discuss.zetetic.net/t/android-database-sqlcipher3-5-9-to-sqlcipher-android-4-5-5/6366 "2024-04-02T17:23:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anshuman\_Biswal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/anshuman_biswal/32/2083_2.png) [@Anshuman\_Biswal](https://discuss.zetetic.net/u/Anshuman_Biswal)\
**Post date:** [April 2, 2024, 5:23pm UTC](https://discuss.zetetic.net/t/android-database-sqlcipher3-5-9-to-sqlcipher-android-4-5-5/6366/1 "2024-04-02T17:23:43Z")

</div>

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/](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)

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [April 8, 2024, 6:38pm UTC](https://discuss.zetetic.net/t/android-database-sqlcipher3-5-9-to-sqlcipher-android-4-5-5/6366/2 "2024-04-08T18:38:27Z")

</div>

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](https://discuss.zetetic.net/t/upgrading-to-sqlcipher-4/3283) for SQLCipher 4 as SQLCipher 4 will not open older databases by default.

---

<div class="post-metadata">

**Author:** ![Abbagouni](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/abbagouni/32/2238_2.png) [@Abbagouni](https://discuss.zetetic.net/u/Abbagouni)\
**Post date:** [June 5, 2024, 8:45am UTC](https://discuss.zetetic.net/t/android-database-sqlcipher3-5-9-to-sqlcipher-android-4-5-5/6366/3 "2024-06-05T08:45:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [June 5, 2024, 3:14pm UTC](https://discuss.zetetic.net/t/android-database-sqlcipher3-5-9-to-sqlcipher-android-4-5-5/6366/4 "2024-06-05T15:14:30Z")

</div>

Hi @Abbagouni,

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