Android 无法使用 Nexus One 访问 DDMS 文件资源管理器中的数据文件夹!

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3259380/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 09:19:17  来源:igfitidea点击:

Can't access data folder in the File Explorer of DDMS using a Nexus One!

androidddms

提问by Giorgio

I have my Nexus One connected with the USB.

我的 Nexus One 已通过 USB 连接。

When I visit the File Explorer of the DDMS, if I click on the "data" folder the little plus near the name "data" disappear for 2-6 seconds and then reappear but the contenct of the folder "data" is not showed!

当我访问DDMS的文件资源管理器时,如果我点击“data”文件夹,名称“data”附近的小加号消失2-6秒然后重新出现,但没有显示文件夹“data”的内容!

Here some other information:

这里有一些其他信息:

  • the folder data has permissions drwxrwx--x

  • the OS of my PC is Windows XP

  • Eclipse v. 3.5.2

  • Android SDK 1.6

  • 文件夹数据具有权限 drwxrwx--x

  • 我电脑的操作系统是 Windows XP

  • Eclipse v. 3.5.2

  • 安卓 SDK 1.6

采纳答案by Chris Stratton

If the adbd daemon is running as root, you can browse /data using adb-based tools such as the DDMS file explorer or the adb shell.

如果 adbd 守护进程以 root 身份运行,您可以使用基于 adb 的工具(例如 DDMS 文件浏览器或 adb shell)浏览 /data。

If it's not, you can access a few files under /data and its children directly by their full path names, but you cannot browse (or 'cd' to) most of the folders, including /data itself.

如果不是,您可以直接通过完整路径名访问 /data 及其子项下的一些文件,但您无法浏览(或 'cd' 到)大多数文件夹,包括 /data 本身。

"rooting" as an unofficial process means varying things and produces varying results - ie, adbd may or may not run as root.

“生根”作为一个非官方的过程意味着不同的事物并产生不同的结果——即,adbd 可能会或可能不会以 root 身份运行。

If ro.secure is set to 0 in the startup scripts such as /init.rc, adbd will run as root, but that may not be a good idea on a user device. It is set to 0 on the emulator, and that's why you can browse /data there.

如果在 /init.rc 等启动脚本中将 ro.secure 设置为 0,则 adbd 将以 root 身份运行,但这在用户设备上可能不是一个好主意。它在模拟器上设置为 0,这就是您可以在那里浏览 /data 的原因。

Finally, note that /init.rc is usually contained in a ramdisk image packed onto the kernel - you can't really edit it on the phone but would have to modify the image offline, re-attach it to the kernel, and re-flash them. Though if you have some sort of working 'su' hack you may be able to change the property temporarily and restart adbd.

最后,请注意 /init.rc 通常包含在打包到内核的 ramdisk 映像中 - 您无法在手机上真正编辑它,但必须离线修改映像,将其重新附加到内核,然后重新 -闪光它们。但是,如果您有某种有效的“su”黑客,您可以暂时更改该属性并重新启动 adbd。

回答by Graph

In this link (http://denniskubes.com/2012/09/25/read-android-data-folder-without-rooting/) Dennis Kubes shows a method for accessing your application's data folder without root access.

在此链接 ( http://denniskubes.com/2012/09/25/read-android-data-folder-without-rooting/) 中,Dennis Kubes 展示了一种无需 root 访问即可访问应用程序数据文件夹的方法。

Turns out there is a simple solution, the run-as command.

原来有一个简单的解决方案,即 run-as 命令。

run-as com.your.package ls -l /data/data/com.your.package
run-as com.your.package rm /data/data/com.your.package/databases/mydatabase.db

That will allow you to run commands as your app. You can also use run-as in interactive mode.

这将允许您将命令作为您的应用程序运行。您还可以在交互模式下使用 run-as。

run-as com.your.package
shell@android:/data/data/com.your.package $ ls
cache
databases
lib
shared_prefs
rm databases/mydatabase.db

Interactive mode will drop you into the data folder for your app. You can navigate from there.

交互模式会将您放入应用程序的数据文件夹中。您可以从那里导航。

回答by Vince

I don't think anyone really understands this question. Giorgio can use the DDMS File Explorer to browse the ./data folder on his phone. Pentium10 talks about needing root access on the phone.

我认为没有人真正理解这个问题。Giorgio 可以使用 DDMS 文件资源管理器浏览手机上的 ./data 文件夹。Pentium10 谈到需要在手机上进行 root 访问。

Well I a retail Nexus One and a developer Nexus. I have always been able to use DDMS File Explorer to browse the ./data folder on my developer phone but not my retail phone. So I rooting my retail phone would help. I didn't.

好吧,我是零售 Nexus One 和开发商 Nexus。我一直能够使用 DDMS 文件资源管理器浏览我的开发者手机上的 ./data 文件夹,而不是我的零售手机。所以我扎根我的零售手机会有所帮助。我没有。

So the bottom line is there is something different about the retail and developer phones. Until more research is done you won't be able to browse the data folder on your phone.

所以底线是零售和开发者手机有些不同。在完成更多研究之前,您将无法浏览手机上的数据文件夹。

Hope this helps.

希望这可以帮助。