I experience crashes on some devices when using SQLiteAssetHelper in my application, most of all on OnePlus devices. Now I read here that it is associated with the directory in which the database is stored.
Now I'm trying to find a workaround, the best I could come up with is currently a constructor like this
public MySubclass(Context context) { super(context, databaseName, context.getFilesDir() + "/databases", null, databaseVersion);
Is this the right way to do this, or are there other issues with this approach?
EDIT
The exception is
Fatal Exception: android.database.sqlite.SQLiteException: Can't upgrade read-only database from version x to y: /data/data/my.package.id/databases/database.db
Sorry, I linked the wrong SO question: this is the right option . It says: "OnePlus can copy the database to / data / data / package -name / databases / filename.db, but it does not allow access to this data, and I have no idea about it."
source share