adb opendir failed, Permission denied

今天第一次通过usb调试模式管理安装的app,通过ls查看安装app的时候,提示没权限,找到的解决过程记下来

D:\Android-SDK\platform-tools>adb shell ls /data
opendir failed, Permission denied(没有权限)

现在问题是我已经root:
google找到adb shell可以su root切换用户,切换之后就不再报权限的错误了。附带找到修改app应用配置文件的内容一并记下来。

从理论上说,USB调试模式下,不Root的机器就可以刷机,既然连rom都可以刷,那么应该是可以读写root分区下的文件了吧?而且我要修改的只是某个应用的data文件,并没有去修改system系统文件。

不需要Root,用Android SDK的adb工具就能搞定。只需要手机开启“USB调试模式”就可以。

把需要修改的文件copy到SD卡根目录,以方便修改和覆盖:

D:\Android-SDK\platform-tools> adb shell su -c "cat /data/data/com.spryfox.tripletown/shared_prefs/com.spryfox.tripletown.xml >/mnt/sdcard/111.txt" root

把该文件从手机传到电脑:

D:\Android-SDK\platform-tools> adb pull /mnt/sdcard/111.txt d:\111.txt
743 KB/s (11899 bytes in 0.015s)

用任意一款文本编辑器,编辑电脑里的 d:\111.txt
修改,保存

把该文件传回手机:

D:\Android-SDK\platform-tools>adb push d:\111.txt /mnt/sdcard/111.txt
57 KB/s (11928 bytes in 0.203s)

把该文件覆盖设备系统data目录的配置文件:

D:\Android-SDK\platform-tools> adb shell su -c "cat /mnt/sdcard/111.txt >/data/data/com.spryfox.tripletown/shared_prefs/com.spryfox.tripletown.xml" root

最后,删除SD卡根目录的 111.txt 搞定!!

http://bbs.xiaomi.cn/thread-5604971-1-1.html