Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to collect data from a .db file of SQLite in Android

I am building an application in Android. I have used SQLite Database Browser 2.0 to create my database file and kept it in the assets folder.

Here is my project

I already created the database using code. I also visited this link.

How do I get the error list?

The error list:

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)
like image 367
kaushikSuman Avatar asked Dec 07 '25 21:12

kaushikSuman


1 Answers

I got the same issue. Your database file in the assets folder does not have a table with the name "android_metadata'. So first you have to create it:

  1. Open your SQLite Database Browser -> open the database file from your project's assets folder -> Click on Execute SQL -> copy and paste the query "CREATE TABLE android_metadata (locale TEXT)" and click Execute query-> click on the save button.

  2. Now remove the old database files from DDMS, /data/data/com.crews.sampledatabaseproto.activity/databases/ or just uninstall the application from the device/emulator.

  3. Put your newly created db file into assets folder.

  4. Run your project.

like image 166
Nishant Avatar answered Dec 10 '25 11:12

Nishant