从Android设备读取数据库文件 [英] Reading database file from android device

查看:192
本文介绍了从Android设备读取数据库文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直想从我的用于开发Android应用拉我SQLite数据库的副本。我的第一次尝试是调用:

I've been trying to pull a copy of my sqlite database from my android app for dev. My first attempt was to call:

./adb shell
cd data/data
cd com.example.app
cd databases

但后来我被困在这里,因为我没有权限做了,甚至查看该目录中的文件!

But then I get stuck here as I do not have permission to do a pull or even view the files in that dir!

所以,我想我会尝试一下DDMS文件浏览器,给了我这样的:

So I thought I'd try out the DDMS File Explorer which gives me this:

但是,当我试图从这里拉文件(我希望他们能够在数据文件夹),它只是拉的目录,没有别的。我怎样才能做到这一点拉我的应用程序创建数据库的副本/使用?

But when I try and pull files from here (I would expect them to be in the data folder) it just pulls the directory and nothing else. How can I do this to pull a copy of the database my app is creating/using?

我已经试过这时候,手机上的SD卡和手机内存。我想我可以复制到SD卡上,然后将SD卡的PC,而不是手机,做这样的说法?不知道这是否会工作,是相当恼人的dev的那样的!

I have tried this when the phone is on the SD card and on phone memory. I guess I could copy to SD card and then plug the SD card to pc rather than the phone and do it that way? Not sure if it would work and would be rather annoying to dev like that!

感谢

推荐答案

如果你只需要数据库一般检查/查看您可以在模拟器上运行你的应用程序,并从那里得到的DB。如果您需要在设备上的特定情况下,你需要以root您的设备为别人所提出的建议。

IF you just need the DB for general checking/viewing you can run your app on the emulator and get the DB from there. If you need the specific instance on your device you need to root your device as others are suggesting.

这篇关于从Android设备读取数据库文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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