为什么不能“数据”?文件夹是否像 DDMS 文件资源管理器中一样显示?
我通过以下方式列出“/”中的文件:
File directory = new File("/");
fill_listview(directory.listFiles());
我在列表中获取了这些文件:
sqlite_stmt_journals
config
cache
sdcard
d
etc
system
sys
sbin
proc
init.rc
init.goldfish.rc
init
default.prop
data
root
dev
我有两个问题:
1.为什么我不能像 Eclipse DDMS 文件资源管理器一样访问“/data”文件夹?
2.为什么和DDMS不一样,DDMS只显示:
data
sdcard
system
谢谢!
I list out files in '/' by:
File directory = new File("/");
fill_listview(directory.listFiles());
And I get those in list:
sqlite_stmt_journals
config
cache
sdcard
d
etc
system
sys
sbin
proc
init.rc
init.goldfish.rc
init
default.prop
data
root
dev
I have two questions:
1.Why cann't I access '/data' folder just like Eclipse DDMS file explorer?
2.Why it is different from the DDMS which show only:
data
sdcard
system
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 root 设备上,您可以执行以下操作来访问 /data 文件夹:
adb shell
”su
此后您应该能够浏览设备上的文件。
On rooted device you can do this to access the /data folder:
adb shell
'su
chmod 777 /data /data/data /data/data/com.application.pacakage
After this you should be able to browse the files on the device.
这主要是因为安全问题。如果 /data 文件夹对每个人都可见,那么某些恶意应用程序可以读取/篡改/删除其他某些应用程序的数据,如果某些应用程序存储一些敏感数据(例如密码/信用卡号等),情况可能会变得更糟。因此整个文件系统仅通过调试控制台(或 ddms)可见。
除非已获得 root 权限,否则您无法访问设备上任何应用程序的数据,因为这样做可能会损害系统的完整性,并可能导致奇怪的行为。这意味着您无法访问应用程序的缓存数据/数据库。
It is mostly because of security issues. If /data folder is visible to everyone, then some malicious app can read/temper/delete the data of some other app which can get really worse if some app is storing some sensitive data like password/credit card number etc. So the whole filesystem is only visible via debug console (or ddms).
You can not access data of any app on the device unless it is rooted because by doing so, integrity of system might be compromised and it may lead of weird behavior. Which means you can not access cached data/databases of app.
我在非 root 设备上执行此操作并且它有效
参考:http://denniskubes.com/2012/09/25/read-android-data-folder-without-rooting/
I did this on a non-rooted device and it worked
Reference: http://denniskubes.com/2012/09/25/read-android-data-folder-without-rooting/