使用条件
For the run-as command to work the app must be debuggable. This means that run-as will work for apps that you are developing and have deployed through eclipse and for any apps that have been released with the debuggable flag turned on. It will not work for most android system and commercially released apps. Sorry, no hacking your favorite app this way.
1.使用adb命令时的错误
如果直接使用adb命令会产生以下错误:
127|shell@android:/ $ cd /data
cd /data
shell@android:/data $ ls
ls
opendir failed, Permission denied
你是没有权限的。
2.正确使用adb读取data目录下的文件方式
shell@android:/data $ run-as com.your.package
run-as com.your.package
shell@android:/data/data/com.your.package $ cd /data/data/com.your.package
cd /data/data/com.your.package
shell@android:/data/data/com.your.package $ ls
ls
cache
databases
lib