获取SQLite数据库从仿真器(数据/数据​​/程序包/数据库)到本地驱动器 [英] Getting SQLite database from emulator (data/data/package_name/databases) to local drive

查看:132
本文介绍了获取SQLite数据库从仿真器(数据/数据​​/程序包/数据库)到本地驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用SQLite的浏览器来编辑我的应用程序的数据库。我能够编辑使用亚行外壳(sqlite3的)数据库,但我会使用GUI而不是命令行而编辑。我如何从模拟器上的DB到本地驱动器?截至目前我已经试过:

I would like to edit my app's DB using the SQLite Browser. I'm able to edit the DB using the adb shell (sqlite3), but I would rather edit it using a GUI rather than a command line. How do I get the DB from the emulator to a local drive? As of now I've tried:

1)使用ADB pull命令从仿真数据库​​来拉我的本地驱动器。

1) using the adb pull command to pull the database from the emulator to my local drive.

亚行拉数据/数据​​/ com.myapps.quiz C:/

adb pull data/data/com.myapps.quiz c:/

该命令执行正确,但我没能找到我指定的本地驱动器中的文件或目录。

This command executes correctly, but I'm not able to find the file or directory in the local drive I specified.

2)中使用的DDMS角度来定位文件资源管理器中的文件,但我每次进入数据/数据​​目录的时候,我只看到所谓的骗子的目录。我甚至尝试拉动整个数据/数据​​目录,但我无法找到包(com.myapps.quiz),其中存储数据库的名称。

2) Used the DDMS Perspective to locate the file in the File Explorer, but every time I get into the data/data directory, I only see directories called "con". I even tried pulling the entire data/data directory, but I can't find the name of the package (com.myapps.quiz) where the database is stored.

我在想什么吗?任何帮助,您可以提供将是最有帮助的!

What am I missing here? Any help you could provide would be most helpful!

推荐答案

您的数据库是安全的,以你的包,所以你不能把这个直接。

Your database is secure to your package so you cannot get this directly.

我有一个变通这一点。

我要做的就是去外壳和运行作为我的包和复制数据库中使用到SD卡的猫

What I do is go to shell and run-as my package and copy the database to sdcard using cat

adb shell
run-as your.package.name
cd databases
cat your_database.db > /mnt/sdcard/your_database.db

和我拉使用文件资源管理器的SD卡文件

And I pull the file from the sdcard using File Explorer

这篇关于获取SQLite数据库从仿真器(数据/数据​​/程序包/数据库)到本地驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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