GreenDao處理數據庫降級的時候報 getDatabase called recursively 異常
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//錯誤姿勢,這里很容易想到調用this.getWritableDb(), this.getWritableDb() 這樣會導致 數據庫 onCreate, 然后又onDowngrade, 然后又onCreate ...造成上面的異常
DaoMaster.dropAllTables(this.getWritableDb(), true);
//正確的姿勢是下面這種
DaoMaster.dropAllTables(this.wrap(db), true);
DaoMaster.createAllTables(this.wrap(db), true);
}