0

アセット フォルダからデータベースをコピーしようとすると、次のエラーが発生します。

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 のアセット フォルダーからデータベースをコピーします。このコードを実行すると、上記のエラーが表示されます

4

1 に答える 1

0

上記のエラーは、アプリがAndroidアプリケーションではなく通常のJavaアプリケーションとして実行されていたために発生しました。

上記の問題を解決するには、Eclipseのプロジェクトの実行構成をAndroidアプリケーションに変更するだけです。ありがとう

于 2013-03-20T15:00:20.977 に答える