'App Crashes when Room DB Entity Class object boolean value is changed to false

I have a Room DB setup in my app and it was working well until recently when the app started crashing. It happens that I have a boolean value as a field in the Entity table and when ever the value changes to true the app crashes even if the DB is not updated.

I have the following error in my logs.

E/SQLiteLog: (1) no such table: room_table_modification_log in "SELECT

  • FROM room_table_modification_log WHERE invalidated = 1;" E/ROOM: Cannot run invalidation tracker. Is the db closed? android.database.sqlite.SQLiteException: no such table: room_table_modification_log (code 1 SQLITE_ERROR): , while compiling: SELECT * FROM room_table_modification_log WHERE invalidated = 1; at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1045) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:652) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590) at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:61) at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37) at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46) at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1564) at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1539) at androidx.sqlite.db.framework.FrameworkSQLiteDatabase.query(FrameworkSQLiteDatabase.java:183) at androidx.room.RoomDatabase.query(RoomDatabase.java:530) at androidx.room.RoomDatabase.query(RoomDatabase.java:513) at androidx.room.InvalidationTracker$1.checkUpdatedTable(InvalidationTracker.java:460) at androidx.room.InvalidationTracker$1.run(InvalidationTracker.java:433) 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:923) E/AndroidRuntime: FATAL EXCEPTION: main Process: com.nugitech.bosscab.driver, PID: 16092 java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed. at android.database.sqlite.SQLiteConnectionPool.throwIfClosedLocked(SQLiteConnectionPool.java:1071) at android.database.sqlite.SQLiteConnectionPool.waitForConnection(SQLiteConnectionPool.java:685) at android.database.sqlite.SQLiteConnectionPool.acquireConnection(SQLiteConnectionPool.java:380) at android.database.sqlite.SQLiteSession.acquireConnection(SQLiteSession.java:896) at android.database.sqlite.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:754) at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:66) at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeUpdateDelete(FrameworkSQLiteStatement.java:46) at info.mqtt.android.service.room.MqMessageDao_Impl.deleteClientHandle(MqMessageDao_Impl.java:229) at info.mqtt.android.service.MqttConnection.connect(MqttConnection.kt:105) at info.mqtt.android.service.MqttService.connect(MqttService.kt:289) at info.mqtt.android.service.MqttAndroidClient.doConnect(MqttAndroidClient.kt:253) at info.mqtt.android.service.MqttAndroidClient.access$doConnect(MqttAndroidClient.kt:39) at info.mqtt.android.service.MqttAndroidClient$MyServiceConnection.onServiceConnected(MqttAndroidClient.kt:1259) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1972) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2004) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:268) at android.app.ActivityThread.main(ActivityThread.java:8016) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)

and this:

E/Report ::: java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.

--------- Stack trace ---------

    android.database.sqlite.SQLiteConnectionPool.throwIfClosedLocked(SQLiteConnectionPool.java:1071)
    android.database.sqlite.SQLiteConnectionPool.waitForConnection(SQLiteConnectionPool.java:685)
    android.database.sqlite.SQLiteConnectionPool.acquireConnection(SQLiteConnectionPool.java:380)
    android.database.sqlite.SQLiteSession.acquireConnection(SQLiteSession.java:896)
    android.database.sqlite.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:754)
    android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:66)
    androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeUpdateDelete(FrameworkSQLiteStatement.java:46)
    info.mqtt.android.service.room.MqMessageDao_Impl.deleteClientHandle(MqMessageDao_Impl.java:229)
    info.mqtt.android.service.MqttConnection.connect(MqttConnection.kt:105)
    info.mqtt.android.service.MqttService.connect(MqttService.kt:289)
    info.mqtt.android.service.MqttAndroidClient.doConnect(MqttAndroidClient.kt:253)
    info.mqtt.android.service.MqttAndroidClient.access$doConnect(MqttAndroidClient.kt:39)
    info.mqtt.android.service.MqttAndroidClient$MyServiceConnection.onServiceConnected(MqttAndroidClient.kt:1259)
    android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1972)
    android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2004)
    android.os.Handler.handleCallback(Handler.java:938)
    android.os.Handler.dispatchMessage(Handler.java:99)
    android.os.Looper.loop(Looper.java:268)
    android.app.ActivityThread.main(ActivityThread.java:8016)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)

This is the entity table

@Entity(tableName = "ModelLoginSignup")
data class SignupModel(
    @PrimaryKey(autoGenerate = true)
    var id: Int = 0,

    var driverOnline: Boolean = false,

    var otp: Int? = null,

    var TodayEarnings: Float? = null,

    var driverCurrentCarGrade: Int? = null,

    var bookingRunning: Int? = null,

    var driverName: String? = null,


    var driverImage: String? = null,

    var driverPhone: String? = null,

    var driverEmail: String? = null,

    var driverDob: String? = null,

    var driverPassword: String? = null,

    var driverGender: Int? = null,

    var driverIsActive: Int? = null,

    var driverAvgRate: Float? = null,

    var driverManageCar: Int? = null,

    var driverSetCurrentCar: Int? = null,

    var showWalletsDriver: String? = null,

    var driverAddMoney: String? = null,

    var minuteFlag: String? = null,

    var minutes: String? = null,

    var locationLimit: Int? = null,

    var distanceVariant: Int? = null,

    var countryCode: String? = null,

    var dateFormate: String? = null,

    var dateFormat: String? = null,

    var creditLimit: Int = 0,

    var locationMeter: Int? = null,

    var currencySymbol: String = "",

    var driverCurrentCar: String? = null,

    var totalJobs: Int? = null,

    var hoursOnline: Int = 0,

    var walletBalance: Float = 0.0f,

    var jwtToken: String = ""

) {

    var status = false

    var statusCode = 0

    var driverId: String? = null
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source