当我尝试从资产文件夹复制数据库时出现以下错误。
Error: A fatal error has been detected by the Java Runtime Environment:
# Internal Error (classFileParser.cpp:3470), pid=6696, tid=4792
# Error: ShouldNotReachHere()
#
# JRE version: 7.0-b147
# Java VM: Java HotSpot(TM) 64-Bit Server VM (21.0-b17 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# hs_err_pid6696.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
代码链接: Sqlite 数据库未从资产文件夹 Android 复制
编辑:
AssetManager am = getApplicationContext().getAssets();
OutputStream os = new FileOutputStream("/data/data/"+getPackageName+"/databases/dbname.sqlite");
byte[] b = new byte[100];
int r;
InputStream is = am.open("dbname.sqlite");
while ((r = is.read(b)) != -1) {
os.write(b, 0, r);
}
is.close();
os.close();
}
我正在尝试运行此代码。此代码从 android 的资产文件夹中复制数据库。当我运行此代码时..它显示上述错误