更新时间:2023-01-19 14:15:03
数据库正在尝试更新其版本,但是由于升级是一种写操作,因此无法在您请求的只读数据库上完成,因此会出现错误
The database is trying to update it's version, but since upgrading is a writing operation it can not be done on the read only database you are requesting, hence the error.
public Cursor getChampions() {
SQLiteDatabase db = getWritableDatabase();
db.close();
db = getReadableDatabase();
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
....
}
这将首先创建一个可写数据库,升级数据库,然后您可以使用只读数据库. 请注意,运行此代码后,您可以删除这些行.
This will create a writable database first, upgrade the database, and then you can use a read-only database. Note that after running this code you can remove those lines.