Failed to collect data from SQLite .db file in Android

I am creating an Android application. I used SQLite Database Browser 2.0 to create my database file and saved it in assets folder .

Here is my project

I have already created a database using code. I also visited this link .

How do I get a list of errors?

List of errors:

03-29 14:56:05.308: E/Database(332): sqlite3_open_v2("/data/data/com.crews.sampledatabaseproto.activity/databases/food_joint_db.db", &handle, 1, NULL) failed
03-29 14:56:05.427: W/dalvikvm(332): threadid=1: thread exiting with uncaught exception (group=0x40015560)
03-29 14:56:05.437: E/AndroidRuntime(332): FATAL EXCEPTION: main
03-29 14:56:05.437: E/AndroidRuntime(332): java.lang.Error: Error copying database
03-29 14:56:05.437: E/AndroidRuntime(332):  at com.crews.sampledatabaseproto.activity.DataBaseHelper.createDataBase(DataBaseHelper.java:48)
03-29 14:56:05.437: E/AndroidRuntime(332):  at com.crews.sampledatabaseproto.activity.SampleDatabaseProtoActivity.onCreate(SampleDatabaseProtoActivity.java:19)
03-29 14:56:05.437: E/AndroidRuntime(332):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-29 14:56:05.437: E/AndroidRuntime(332):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-29 14:56:05.437: E/AndroidRuntime(332):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-29 14:56:05.437: E/AndroidRuntime(332):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-29 14:56:05.437: E/AndroidRuntime(332):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-29 14:56:05.437: E/AndroidRuntime(332):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-29 14:56:05.437: E/AndroidRuntime(332):  at android.os.Looper.loop(Looper.java:123)
03-29 14:56:05.437: E/AndroidRuntime(332):  at android.app.ActivityThread.main(ActivityThread.java:3683)
03-29 14:56:05.437: E/AndroidRuntime(332):  at java.lang.reflect.Method.invokeNative(Native Method)
03-29 14:56:05.437: E/AndroidRuntime(332):  at java.lang.reflect.Method.invoke(Method.java:507)
03-29 14:56:05.437: E/AndroidRuntime(332):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-29 14:56:05.437: E/AndroidRuntime(332):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-29 14:56:05.437: E/AndroidRuntime(332):  at dalvik.system.NativeStart.main(Native Method)

      

+3


source to share


1 answer


I have the same problem. There is no table named "android_metadata" in your database file in the assets folder. Therefore, you must first create it:



  • Open your SQLite Database Browser -> open the database file from the project resources folder -> Click Run SQL -> copy and paste the query "CREATE TABLE android_metadata (locale TEXT)" and click Run Query -> click save button.

  • Now delete the old database files from DDMS, / data / data / com.crews.sampledatabaseproto.activity / databases / or just uninstall the app from device / emulator.

  • Place your newly created db file in your assets folder.

  • Run the project.

+5


source







All Articles