简单的说,就是获取服务器的相同的数据库并替代已有的同名的数据库,数据库的名字和格式都一样,这部分现在已经实现了。
但是接下来的使用出现了问题,大家帮我想想办法:
1.所有的列的类型都变成了BLOB(如果是在不行还是可以改)
2.使用时报错 Caused by: android.database.sqlite.SQLiteException: Can't upgrade read-only database from version 0 to 2: ,但是我在数据库传输完成之后有给它提升权限的语句:
String command = "chmod 777 " + "/data/data/(我的包名)/databases/" + local;
try {
process = Runtime.getRuntime().exec(command);
Log.i("command","The Command is : "+command);
process.waitFor();
} catch (Exception e) {
Log.w("Exception ", "Unexpected error - "+e.getMessage());
} finally {
try {
process.destroy();
} catch (Exception e) {
Log.w("Exception ", "Unexpected error - "+e.getMessage());
}
}
而且报错部分是“Can't upgrade”。有没有做过类似需求的?
但是接下来的使用出现了问题,大家帮我想想办法:
1.所有的列的类型都变成了BLOB(如果是在不行还是可以改)
2.使用时报错 Caused by: android.database.sqlite.SQLiteException: Can't upgrade read-only database from version 0 to 2: ,但是我在数据库传输完成之后有给它提升权限的语句:
String command = "chmod 777 " + "/data/data/(我的包名)/databases/" + local;
try {
process = Runtime.getRuntime().exec(command);
Log.i("command","The Command is : "+command);
process.waitFor();
} catch (Exception e) {
Log.w("Exception ", "Unexpected error - "+e.getMessage());
} finally {
try {
process.destroy();
} catch (Exception e) {
Log.w("Exception ", "Unexpected error - "+e.getMessage());
}
}
而且报错部分是“Can't upgrade”。有没有做过类似需求的?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货