How To Solve Greendao "no Such Table Exists Error" When Doing An Insertorreplace?
Solution 1:
For me this issue was related to this allowBackup flag in the manifest.
This functionality was added from api 23 onwards and the effect of it is to restore the device database even when the app has been uninstalled, so if you're trying to clear the database by uninstalling it wont work as Android restores it, similar to how iCloud works.
I could be missing somewhere in the documentation that explains this error but it isn't clear to me that this could be an issue in GreenDao 3. Additionally as many users will set up a test entity and not consider handling the upgrade path as they have no desire to retain the test table, which results in the scenario of a single table restored and the new tables not being created.
So essentially if you're just testing set the flag to false otherwise handle the upgrade flow. (the flag defaults to true!)
https://developer.android.com/guide/topics/data/autobackup.html
Solution 2:
I followed this guide and was having the same problem. I had the database name wrong, for some reason. Check that they are named the same in the AndroidManifest.xml file:
<meta-data
android:name="DATABASE"
android:value="notes.db"/>
And in your class that extends Application:
DaoMaster.DevOpenHelperhelper=newDaoMaster.DevOpenHelper(this, "notes.db");
Solution 3:
Have you did this?
mSQLiteDatabase = mOpenHelper.getWritableDatabase();mDaoMaster = new DaoMaster(mSQLiteDatabase);mDaoSession = mDaoMaster.newSession();appTimeUsageDao = mDaoSession.getAppTimeUsageDaoDao();
Post a Comment for "How To Solve Greendao "no Such Table Exists Error" When Doing An Insertorreplace?"