GreenDao:no such table 找不到表的終極解決方案!

錯誤日志:

android.database.sqlite.SQLiteException: no such table: FEED_LOAD_TIMES_ENTITY (code 1): , 
while compiling: INSERT INTO "FEED_LOAD_TIMES_ENTITY" ("_id","LOAD_TIMES") VALUES (?,?)     
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)   
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)     
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)  
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)    
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)  
at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)  
at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:994)     
at org.greenrobot.greendao.database.StandardDatabase.compileStatement(StandardDatabase.java:67)     
at org.greenrobot.greendao.internal.TableStatements.getInsertStatement(TableStatements.java:52)     
at org.greenrobot.greendao.AbstractDao.insert(AbstractDao.java:319) 

發生環境:

1.線上app有兩張表A、B,數據庫版本為3;
2.當前開發版本新增了一個表C,升級數據庫版本為4;
3.只安裝當前開發版本,沒有任何問題;
4.從線上版本升級到開發版本,報上面那個錯誤,找不到表C。

解決方案:
https://github.com/yuweiguocn/GreenDaoUpgradeHelper

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容