1

When I run my application on my phone, I get the exception:

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.

I know that I can use the method

fallbackToDestructiveMigration

But if I use it, then the callBack "onCreate" is never invoked (and I need it to be invoked).

The weird thing is that i get the message even if I "clear data" of the application (via de settings) and unistall the application. Apparently the database is never really removed from the phone, because I keep getting a versions conflict.

How can I really delete the database from the phone?

Thank you!

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Mr.Eddart
  • 10,050
  • 13
  • 49
  • 77

1 Answers1

3

You can simply delete application or remove application data in your phone android system settings. Remember about:

<manifest ... >
...
<application android:allowBackup="false" ... >
    ...
</application>

or Room persistance library. Delete all

DawidJ
  • 1,245
  • 12
  • 19
  • I do this, but suprisingly it seems that the database is not really deleted, the phone remembers it and raises a version conflict even after uninstalling application. I don't understand... – Mr.Eddart Dec 23 '18 at 16:44
  • You can check if your database file is still saved at your phone via ADB. There is also `fallbackToDestructiveMigration()` method which you can set in `Room.databaseBuilder()` Edit: I am glad that I was able to help You :) – DawidJ Dec 23 '18 at 16:53