需要
adb(Android Debug Bridge)才能通过命令行访问仿真器设备的文件系统.如果你还没有安装它,你可以
download it here.
安装后,只需使用一些命令即可查看/访问文件:
Open Terminal.app.
Execute adb devices (this should list your current emulator devices).
Connect to the emulator device with adb shell .
Change directory cd to the folder where your app databases are.
Type ls to see which database files are present.
在终端中,它看起来像这样:
列出模拟器设备:
$adb devices
List of devices attached
emulator-5554 device
使用adb shell连接到设备:
$adb -s emulator-5554 shell
将目录(cd)更改为SQLite3数据库位置(包名通常是com …):
adb shell
$cd /data/data//databases/
列出数据库目录中的文件:
adb shell
$ls
db.sqlite3
这真的是它的基础!也可以通过推/拉将文件从模拟器(远程)复制到(本地)文件系统:
adb pull /data/data/com.yourpackagename.app/databases/db.sqlite3 /local/save/path
如果拒绝权限,则以root模式运行ADB:
adb root
更多信息: