I am trying to auto-populate a database on first app load. I am trying to 'inflate' the database from a local copy like so:
public static synchronized bDB getInstance(Context context) {
if(bDB == null) {
Log.v("Hello", "Inflating database.");
bDB = Room.databaseBuilder(context.getApplicationContext(), BDB.class, databaseName)
.createFromAsset("database/bdb.db")
.fallbackToDestructiveMigration()
.build();
}
return bDB;
}
I noticed an error in the initial file (data error, schema remains the same). I corrected it and updated the file 'bdb.db'. However, every time the database gets pre-populated, it always picks up the old, erroneous data. I have tried the following:
- Cleared and invalidated all caches.
- Cleaned and rebuilt.
- Checked the database file a million times.
While the file in the assets folder is correct, where is it picking up the old data from ?
Any help is most welcome.