Room cannot verify the data integrity

前端 未结 20 2335
一向
一向 2020-12-04 11:43

I am getting this error while running program with Room Database

Room cannot verify the data integrity. Looks like you\'ve changed schema but forgot to updat         


        
20条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 12:14

    Its Very simple as shown in log

    Looks like you've changed schema but forgot to update the Database version number. 
    You can simply fix this by increasing the version number.
    

    Simple go to your Database Version class and upgrade your DB version by increasing 1 from current.

    For Example : Find @Database annotation in your project like below

    @Database(entities = {YourEntityName.class}, version = 1)
    

    Here version = 1, is database version, you have to just increase it by one, Thats it.

提交回复
热议问题