我正在房间应用程序中添加第二列。该应用程序可正常运行,但无法在模拟器上运行。
logcat
E/AndroidRuntime: FATAL EXCEPTION: arch_disk_io_0
Process: app.bluecoral.pbtracker, PID: 11773
java.lang.RuntimeException: Exception while computing database live data.
at androidx.room.RoomTrackingLiveData$1.run(RoomTrackingLiveData.java:92)
at androidx.room.RoomOpenHelper.checkIdentity(RoomOpenHelper.java:139)
at androidx.room.RoomOpenHelper.onOpen(RoomOpenHelper.java:119)
androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:53)
at androidx.room.RoomDatabase.inTransaction(RoomDatabase.java:452)
at androidx.room.RoomDatabase.assertNotSuspendingTransaction(RoomDatabase.java:275)
at androidx.room.RoomDatabase.query(RoomDatabase.java:304)
at androidx.room.util.DBUtil.query(DBUtil.java:54)
at app.bluecoral.pbtracker.PbDao_Impl$5.call(PbDao_Impl.java:102)
at app.bluecoral.pbtracker.PbDao_Impl$5.call(PbDao_Impl.java:99)
at androidx.room.RoomTrackingLiveData$1.run(RoomTrackingLiveData.java:90)
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)
PbDao
@Dao
interface PbDao {
@Query("SELECT * from pb_table ORDER BY pb, pb_value ASC")
fun getAlphabetizedPbs(): LiveData<List<Pb>>
@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun insert(pb: Pb)
@Query("DELETE FROM pb_table")
suspend fun deleteAll()
}