title: Android Room requires migration after data insertion by another app
body: <p>I'm developing an Android app with an embedded SQLite database run with Android Room. I'm moving the app from desktop Java to Android and I need to bring data into the Android database from the old database used with the desktop app. I ran into a problem with Room when I tried using the altered database with my Android app. </p>
  
  <p>I tried taking the database file created by Room and move the data from the old database into this one with a short Java app I coded for this purpose. I simply emptied the relevant tables, read data from the old database and inserted it into the new database.</p>
  
  <p>When I tried moving the database file back to my Android devide and using it with the Android app I got this exception:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>If I change the version of the database in my Room database code, Room would then require a piece of code for the migration even though the structure of the database has not been changed:</p>
  
  <blockquote>
    <p>java.lang.IllegalStateException: A migration from 1 to 2 was required but not found. Please provide the necessary Migration path via RoomDatabase.Builder.addMigration(Migration ...) or allow for destructive migrations via one of the RoomDatabase.Builder.fallbackToDestructiveMigration* methods.</p>
  </blockquote>
  
  <p>I tried clearing the app data cache and clearing all of its data and even uninstalling the app, then reinstalling it with the modified database file. Didn't make the problem go away. I also tried everything here <a href="https://stackoverflow.com/questions/44197309/room-cannot-verify-the-data-integrity">Room cannot verify the data integrity</a> including setting android:allowBackup="false" in my Manifest, and adding fallbackToDestructiveMigration to my database. After trying fallbackToDestructiveMigration, all of my new database's data was gone. But then I put the altered database file back in again and it worked. To be honest, I'm not entirely sure what step made it work. I think it was increasing the version number, running it with fallbackToDestructiveMigration and then moving the new database file back in again when fallbackToDestructiveMigration had wiped data from the database...</p>
  
  <p><strong>My question is</strong> how can Room know the database has been modified when there hadn't been any change to its structure that would make it incompatible with the Entities of my app? And how can know even though I've cleared the app's data from the device? And are there any steps I should take the next time that are not mentioned above? I quess I could just include migration code that does nothing. But that seems kind of silly, I'd like the version number to stay at 1 since the app is in development at the moment.</p>