Issue
I'm just toying around with my schema and I can't get my app to load at all since I changed the schema/Entity class.
I have deleted the app on my testing devic, cleared the caches on AndroidStudio, and rebooted my machine but the error persists. All I did was change the default values of one of my Entity data classes for my Room database.
How do I force AndroidStudio to forget about the old table schema/Entity class without incrementing the version number and providing a migration path?
Error:
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.
Solution
Android Studio doesn't save the database schema information, your app does. So you can clear the app data on your test device and will fix the problem without incrementing your version number.
However without clearing the app data, you can use RoomDatabase.Builder.fallbackToDestructiveMigration()
along with incrementing the version number to avoid implementing migration logic if you're happy to lose the contents of the previous database.
Answered By - Henry Twist
Answer Checked By - Senaida (JavaFixing Volunteer)