Android的:不能从0版本升级只读数据库1 [英] android: Can't upgrade read-only database from version 0 to 1

查看:325
本文介绍了Android的:不能从0版本升级只读数据库1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

结果
我知道有很多话题,有相同的标题,但我已经尝试了所有的人。我没能解决我的问题。结果
我得到的错误是正是这一点:搜索结果
android.database.sqlite.SQLiteException:不能从0版本升级只读数据库,以1:/data/data/com.halilkaya.flashcard/databases/flashcarddb.db搜索结果
其实,它的工作原理在模拟器上,但是当我在我的手机上安装,这是行不通的!


I know there are many topic that have the same title, but I've tried all of them. I couldn't solve my problem.
The error I get is exactly this:

android.database.sqlite.SQLiteException: Can't upgrade read-only database from version 0 to 1: /data/data/com.halilkaya.flashcard/databases/flashcarddb.db

Actually, it works on the emulator, but when I install it on my phone, it doesn't work!

推荐答案

希望您要删除该表并对其进行升级aagain如下

Hope you are dropping the table and upgrading it aagain as below

public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL("DROP TABLE IF EXISTS " + LOCATION_TABLE);
    db.execSQL("DROP TABLE IF EXISTS " + PHONE_TABLE);
    // Create tables again
    onCreate(db);

}

这篇关于Android的:不能从0版本升级只读数据库1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆