Android设备监视器“数据"文件夹是空的 [英] Android Device Monitor "data" folder is empty

查看:221
本文介绍了Android设备监视器“数据"文件夹是空的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经测试了如何在我的apps数据库中创建,插入和检索数据,并且知道它可以通过使用Log语句来工作.

I have tested creating, inserting and retrieving data into my apps db, and know it works through usage of Log statements.

但是,我希望加快测试速度并使用Android设备监视器.但是,尽管数据库存在并且存储了数据,但是在下面访问时,data文件夹为空:

However, I wish to expedite testing and use the Android Device Monitor. However, though the db exists and data is stored, when accessing below, the data folder is empty:

为什么会这样呢?如何配置它以显示db文件和内容?

Why would this be the case? How can this be configured to show the db file and contents?

推荐答案

使用仿真器解决问题

文件夹/data可以为空,因为您缺少适当的权限.为了解决这个问题,我必须执行以下命令.

Solving the issue using an emulator

The folder /data can be empty because you are missing the proper permissions. To solve it, I had to execute the following commands.

adb shell
su

这些命令会在仿真器中启动shell并授予您root权限.命令adb位于Android SDK的文件夹platform-tools中,该文件夹通常安装在MacOS的~/Library/Android/sdk/中.

Those commands starts a shell in the emulator and grant you root rights. The command adb is located in the folder platform-tools of the Android SDK, typically installed in ~/Library/Android/sdk/ on MacOS.

chmod -R 777 /data

修改文件夹(和递归子文件夹)的权限/data,以使其出现在工具A ndroid设备监视器中.

Modify the permissions of the folder (and subfolders recursively) /data in order to make them appear in the tool Android Device Monitor.

adb root

最后,此命令以root身份重新启动adb.请注意,它仅适用于开发版本(通常是仿真程序版本).

Finally, this command restarts adb as root. Be careful, it only works on development builds (typically emulators builds).

然后,您可以查看文件夹/data的内容并传输其中的数据.您也可以在控制台中使用adb pull <remote> <locale>进行操作,例如:

Afterwards, you can see the content of the folder /data and transfer the data located in. You can do it in console as well, using adb pull <remote> <locale>, such as:

adb pull /data/data/<app name>/databases/<database> .

这篇关于Android设备监视器“数据"文件夹是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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