
dachristenson
Kotlin and Android Development featuring Jetpack: Ch 10 (end) program crashes during run
I had the project running as of p. 249, but by the end of Ch. 10 (p. 258), something new has made the program crash when it tries to perform one or more database operations. My Android tablet DOES have an active Internet connection when this happens. Using Logcat, I get this error:
AndroidRuntime com.example.abl E FATAL EXCEPTION: arch_disk_io_0
Process: com.example.abl, PID: 9864
java.lang.RuntimeException: Exception while computing database live data.
at androidx.room.RoomTrackingLiveData.refreshRunnable$lambda$0(RoomTrackingLiveData.kt:74)
at androidx.room.RoomTrackingLiveData.$r8$lambda$PhMGW5zFk4QWazERd2lfEeLZqW0(Unknown Source:0)
at androidx.room.RoomTrackingLiveData$$ExternalSyntheticLambda0.run(Unknown Source:2)
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)
Caused by: java.lang.IllegalStateException: Room cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number. You can simply fix this by increasing the version number. Expected identity hash: 39bfe0dd708bc9d7771a09a627f9e596, found: 3947fff4293a2527ac1bdc53260a7ac0
at androidx.room.RoomOpenHelper.checkIdentity(RoomOpenHelper.kt:146)
at androidx.room.RoomOpenHelper.onOpen(RoomOpenHelper.kt:127)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onOpen(FrameworkSQLiteOpenHelper.kt:287)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:501)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:387)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableOrReadableDatabase(FrameworkSQLiteOpenHelper.kt:232)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.innerGetDatabase(FrameworkSQLiteOpenHelper.kt:190)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getSupportDatabase(FrameworkSQLiteOpenHelper.kt:151)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.kt:104)
at androidx.room.RoomDatabase.inTransaction(RoomDatabase.kt:632)
at androidx.room.RoomDatabase.assertNotSuspendingTransaction(RoomDatabase.kt:451)
at androidx.room.RoomDatabase.query(RoomDatabase.kt:480)
at androidx.room.util.DBUtil.query(DBUtil.kt:75)
at com.example.abl.data.BaseballDao_Impl$9.call(BaseballDao_Impl.java:456)
at com.example.abl.data.BaseballDao_Impl$9.call(BaseballDao_Impl.java:452)
at androidx.room.RoomTrackingLiveData.refreshRunnable$lambda$0(RoomTrackingLiveData.kt:72)
at androidx.room.RoomTrackingLiveData.$r8$lambda$PhMGW5zFk4QWazERd2lfEeLZqW0(Unknown Source:0)
at androidx.room.RoomTrackingLiveData$$ExternalSyntheticLambda0.run(Unknown Source:2)
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)
Also, while I’m not sure if it’s connected, I noticed that Android Studio does not like four lines in nag_graph.xml:
<argument
android:name="teamId"
app:argType="string" />
<argument
android:name="teamName"
app:argType="string" />
This is true for both times that this block appears in nav_graph.xml, and the error is the same: “‘teamId’ [or ‘teamName’] is not a valid destination for tag ‘argument’.” As far as I can tell, my code is identical to the code provided with the book here. Is this another case of something in Android having been changed, or is Android Studio making an error in its static analysis here?
My code can be seen here: GitHub - dachristenson/Android_Baseball_League: Working through Part II of "Kotlin and Android Development Featuring Jetpack" by Michael Fazio.
Thanks in advance!
Marked As Solved

mfazio23
The first issue is due to differences between the database installed on your device versus what you’re trying to deploy. Normally, if the DB is changing you’ll want to create a migration, but for testing, just uninstall and reinstall the app.
The second one is actually an Android Studio bug! I didn’t know this was a thing, but it turns out it’s a known issue: Google Issue Tracker
Let me know if you run into anything else!
Popular Prag Prog topics








Modern Front-End Development for Rails - application does not start after run bin/setup (page xviii)


Other popular topics









Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /sublime-text
- /textmate
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /nodejs
- /lua
- /slackware
- /c
- /julia
- /neovim