SafeRoom 1.0.4 doing app updates crashes

Hi,
So i’ve been using safeRoom for a while and migrated from 0.X to 1.X about a month ago.
migrated from 0.5.1 to 1.0.2
Followed the instructions written in the readme and used the migrate option.
All seemed to work in all devices i tested.
The app went live and now after users updated to the new version and i updated to the latest Saferoom 1.0.4 i’m getting a few crashes when users try to update the app to the latest version.

Fatal Exception: java.lang.RuntimeException: Exception while computing database live data. at androidx.room.RoomTrackingLiveData$1.run(SourceFile:6) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764)

Another part of logs from the sqlcipher itself is :

Caused by net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master; at net.sqlcipher.database.SQLiteCompiledSql.native_compile(SourceFile) at net.sqlcipher.database.SQLiteCompiledSql.compile(SourceFile:3) at net.sqlcipher.database.SQLiteCompiledSql.(SourceFile:12) at net.sqlcipher.database.SQLiteProgram.(SourceFile:18) at net.sqlcipher.database.SQLiteQuery.(SourceFile:1) at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SourceFile:9) at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SourceFile:5) at net.sqlcipher.database.SQLiteDatabase.rawQuery(SourceFile:1) at net.sqlcipher.database.SQLiteDatabase.keyDatabase(SourceFile:6) at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SourceFile:4) at net.sqlcipher.database.SQLiteDatabase.openDatabase(SourceFile:10) at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SourceFile:8) at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SourceFile:14) at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SourceFile:2) at com.commonsware.cwac.saferoom.Helper$OpenHelper.getWritableSupportDatabase(SourceFile:2) at com.commonsware.cwac.saferoom.Helper.getWritableDatabase(SourceFile:5) at androidx.room.RoomDatabase.createInvalidationTracker(SourceFile:25) createOpenHelper inTransaction at androidx.room.RoomDatabase.assertNotSuspendingTransaction(SourceFile:3) at androidx.room.RoomDatabase.createInvalidationTracker(SourceFile:18) createOpenHelper query at androidx.room.util.DBUtil.query(SourceFile:1) at com.myapp.MainActivity$onResume$2.onChanged(SourceFile:1) at com.myapp.MainActivity$onResume$2.call(SourceFile:1) at androidx.room.RoomTrackingLiveData$1.run(SourceFile:5) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764)

Any idea what can it be?

“file is not a database” is a generic SQLCipher for Android error message. It could have countless causes, including an invalid passphrase. There is no specific single cause in SQLCipher for Android, let alone via the SafeRoom wrapper.

Your question indicates three versions of your app, which I will call A, B, and C:

  • A was using SafeRoom 0.5.1
  • B was using SafeRoom 1.0.2
  • C is using SafeRoom 1.0.4

For the crashes, do you have any idea whether they are upgrading from A -> C or B -> C?

So far, I think they update from B->C
Haven’t seen issues with A->B reported but as they gradually update i might see any of them.

If i update to a new version and remove saferoom Entirely - any special actions i need to take in code?
I mean other than renaming the db to a new name.

Sorry, but I do not understand what “update to a new version and remove saferoom Entirely” means, exactly.

If you mean you are switching to using SQLCipher for Android directly, your database access code will be significantly different. Beyond that, any requirements of an upgrade are put there by SQLCipher for Android, so if you go from 3.x to 4.x, you will need to do something to deal with the database format change, akin to what SafeRoom offered for going from 0.x to 1.x.

I meant removing the use of saferoom from the app and issue a new app version with SQLCipher or even without it entirely.

And yes, i thought so about the part with SQLCipher upgrades etc.

Thank you.