E/SQLiteLog: (1) no such table: room_table_modification_log in "INSERT OR IGNORE INTO room_table_modification_log VALUES(2, 0)"

Hi,

We are trying implement your new library for android “implementation net.zetetic:sqlcipher-android:4.5.2@aar” – community edition but we see this error:

E/SQLiteLog: (1) no such table: room_table_modification_log in “INSERT OR IGNORE INTO room_table_modification_log VALUES(2, 0)”
E/AndroidRuntime: FATAL EXCEPTION: main
Process: PID: 7682
net.zetetic.database.sqlcipher.SQLiteException: no such table: room_table_modification_log (code 1): , while compiling: INSERT OR IGNORE INTO room_table_modification_log VALUES(2, 0)
at net.zetetic.database.sqlcipher.SQLiteConnection.nativePrepareStatement(Native Method)
at net.zetetic.database.sqlcipher.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:922)
at net.zetetic.database.sqlcipher.SQLiteConnection.prepare(SQLiteConnection.java:533)
at net.zetetic.database.sqlcipher.SQLiteSession.prepare(SQLiteSession.java:592)
at net.zetetic.database.sqlcipher.SQLiteProgram.(SQLiteProgram.java:64)
at net.zetetic.database.sqlcipher.SQLiteStatement.(SQLiteStatement.java:37)
at net.zetetic.database.sqlcipher.SQLiteDatabase.executeSql(SQLiteDatabase.java:1992)
at net.zetetic.database.sqlcipher.SQLiteDatabase.execSQL(SQLiteDatabase.java:1901)
at androidx.room.InvalidationTracker.startTrackingTable(InvalidationTracker.java:250)
at androidx.room.InvalidationTracker.syncTriggers(InvalidationTracker.java:559)
at androidx.room.RoomDatabase.internalBeginTransaction(RoomDatabase.java:567)
at androidx.room.RoomDatabase.beginTransaction(RoomDatabase.java:555)

    at androidx.room.CoroutinesRoom$Companion$execute$2.invokeSuspend(CoroutinesRoom.kt:65)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at androidx.room.TransactionExecutor$1.run(TransactionExecutor.java:47)
    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:920)

Description:
Database initialization works but select from db return error.

Initialization:
System.loadLibrary(“sqlcipher”)

val factory = SupportOpenHelperFactory(password.toByteArray())

return Room
.databaseBuilder(
appContext,
Database::class.java,
DATABASE_NAME
)
.openHelperFactory(
factory
)
.addMigrations(

)
.build()

Libraries:
com.google.dagger/hilt
androidx.room
androidx.paging
net.zetetic:sqlcipher-android

Any hints on what could we do to overcome this error?

Thanks

Hi @Alain_El_Hakim

Can you pull the database off the device and inspect it, possibly via DB Browser for SQLite [1]? Is the table room_table_modification_log present?


  1. https://sqlitebrowser.org ↩︎

Hi @developernotes ,

Thank you for your prompt reply, we’ve checked a fresh installation, room_table_modification_log is not present.

Thanks and take care,
A.

Hi @Alain_El_Hakim

You will need to evaluate your schema creation routine in that case.

Hi @developernotes ,

room_table_modification_log is in-memory table fully managed (in terms of creation and read/write operations) by Jetpack Room library. The issue we are facing is caused by the fact that process that inserts data to the table runs in parallel with process responsible for table creation and the execution of the first one is finished before the table is actually created.

We understand that described problem might looks like issue in Room library itself or more specifically in the way how we are using it, however we do not experience this issue when we do not use SQLCipher library at all, nor with legacy SQLCipher for Android library. Don’t you know about any changes introduced in new SQLCipher for Android API that might be the cause of the issue.

Thank you in advance

Hi @Alain_El_Hakim,

If this is occurring, you may wish to reach out to the Android Jetpack team [1] to file a bug report as the table would need to be created prior to insertion.


  1. Android Jetpack · GitHub ↩︎

Hi @developernotes,

I’d like to modify the statement from my last comment and provide a reference to the solution of the problem. The in-memory table mentioned in my last comment was not actually created at all due to the error reported here[Room integration issue · Issue #7 · sqlcipher/sqlcipher-android · GitHub].