无法从SQLite的在Android的一个.db文件收集数据 [英] Unable to collect data from a .db file of SQLite in Android

查看:104
本文介绍了无法从SQLite的在Android的一个.db文件收集数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立在Android的应用程序。我已经使用的 SQLite数据库浏览器2.0 以创建我的数据库文件,并将其保存在资产文件夹。

这里是我的项目

我已经创建了使用code数据库。我还参观了此链接

我如何得到错误列表?

错误列表:

  03-29 14:56:05.308:E /数据库(332):sqlite3_open_v2(/数据/数据​​/ com.crews.sampledatabaseproto.activity /数据库/ food_joint_db.db ,和放大器;手柄,1,NULL)失败
03-29 14:56:05.427:W / dalvikvm(332):主题ID = 1:螺纹退出与未捕获的异常(组= 0x40015560)
03-29 14:56:05.437:E / AndroidRuntime(332):致命异常:主要
03-29 14:56:05.437:E / AndroidRuntime(332):java.lang.Error:错误复制数据库
03-29 14:56:05.437:E / AndroidRuntime(332):在com.crews.sampledatabaseproto.activity.DataBaseHelper.createDataBase(DataBaseHelper.java:48)
03-29 14:56:05.437:E / AndroidRuntime(332):在com.crews.sampledatabaseproto.activity.SampleDatabaseProtoActivity.onCreate(SampleDatabaseProtoActivity.java:19)
03-29 14:56:05.437:E / AndroidRuntime(332):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-29 14:56:05.437:E / AndroidRuntime(332):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-29 14:56:05.437:E / AndroidRuntime(332):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-29 14:56:05.437:E / AndroidRuntime(332):在android.app.ActivityThread.access $ 1500(ActivityThread.java:117)
03-29 14:56:05.437:E / AndroidRuntime(332):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:931)
03-29 14:56:05.437:E / AndroidRuntime(332):在android.os.Handler.dispatchMessage(Handler.java:99)
03-29 14:56:05.437:E / AndroidRuntime(332):在android.os.Looper.loop(Looper.java:123)
03-29 14:56:05.437:E / AndroidRuntime(332):在android.app.ActivityThread.main(ActivityThread.java:3683)
03-29 14:56:05.437:E / AndroidRuntime(332):在java.lang.reflect.Method.invokeNative(本机方法)
03-29 14:56:05.437:E / AndroidRuntime(332):在java.lang.reflect.Method.invoke(Method.java:507)
03-29 14:56:05.437:E / AndroidRuntime(332):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:839)
03-29 14:56:05.437:E / AndroidRuntime(332):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-29 14:56:05.437:E / AndroidRuntime(332):在dalvik.system.NativeStart.main(本机方法)
 

解决方案

我得到了同样的问题。在资产的文件夹中的数据库文件没有名称为android_metadata'表所以首先你必须创建它:

  1. 打开SQLite数据库浏览器 - >从项目的资产文件夹中打开数据库文件 - >点击执行SQL - >复制和粘贴查询CREATE TABLE android_metadata(区域设置文本),然后单击执行查询 - >点击保存按钮。

  2. 现在从DDMS,/data/data/com.crews.sampledatabaseproto.activity/databases/删除旧的数据库文件,或者卸载从设备/仿真器的应用程序。

  3. 将新创建的数据库文件转化为资产的文件夹。

  4. 运行项目。

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)

解决方案

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.

这篇关于无法从SQLite的在Android的一个.db文件收集数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆