[英]Android: adb: Permission Denied
Whatever I type after adb shell
it fails with Permission denied
:无论我在
adb shell
之后输入什么,它都会因Permission denied
而失败:
D:\android-sdk-windows\platform-tools>adb shell find /data -name *.db
find: permission denied
D:\android-sdk-windows\platform-tools>adb shell test
test: permission denied
D:\android-sdk-windows\platform-tools>adb remount
remount failed: No such file or directory
Any ideas?有任何想法吗?
According to adb help
:根据
adb help
:
adb root - restarts the adbd daemon with root permissions
Which indeed resolved the issue for me.这确实为我解决了这个问题。
Without rooting : If you can't root your phone, use the run-as <package>
command to be able to access data of your application.不生根:如果您无法生根手机,请使用
run-as <package>
命令来访问应用程序的数据。
Example:例子:
$ adb exec-out run-as com.yourcompany.app ls -R /data/data/com.yourcompany.app/
exec-out
executes the command without starting a shell and mangling the output. exec-out
在不启动 shell 和修改输出的情况下执行命令。
The reason for "permission denied" is because your Android machine has not been correctly rooted. “权限被拒绝”的原因是你的安卓机器没有正确root。 Did you see
$
after you started adb shell
?你在启动
adb shell
后看到$
吗? If you correctly rooted your machine, you would have seen #
instead.如果您正确地植根了您的机器,您会看到
#
代替。
If you see the $
, try entering Super User mode by typing su
.如果您看到
$
,请尝试通过键入su
进入超级用户模式。 If Root is enabled, you will see the #
- without asking for password.如果启用了 Root,您将看到
#
- 而不要求输入密码。
You might need to activate adb root from the developer settings menu.您可能需要从开发人员设置菜单中激活 adb root。 If you run
adb root
from the cmd line you can get:如果您从 cmd 行运行
adb root
,您可以获得:
root access is disabled by system setting - enable in settings -> development options
Once you activate the root option (ADB only or Apps and ADB) adb will restart and you will be able to use root from the cmd line.一旦您激活 root 选项(仅限 ADB 或应用程序和 ADB),adb 将重新启动,您将能够从 cmd 行使用 root。
data
partition not accessible for non root user, if you want to access it you must root your phone.非root用户无法访问
data
分区,如果你想访问它,你必须root你的手机。
adb root
not work for all product and depend in phone build type. adb root
不适用于所有产品并取决于手机构建类型。
in new version on android studio you can explore /data/data
path for debuggable apps.在 android studio 的新版本中,您可以探索可调试应用程序的
/data/data
路径。
以前的解决方案都不适合我,但我能够使用此命令使其工作
adb shell "run-as com.yourcompany.app cat /data/data/com.yourcompany.app/shared_prefs/SHARED_PREF_PROTECTED.xml" > SHARED_PREF_PROTECTED.xml
Whatever I type after adb shell
it fails with Permission denied
:无论我在
adb shell
之后键入什么内容,都将失败,并且Permission denied
:
D:\android-sdk-windows\platform-tools>adb shell find /data -name *.db
find: permission denied
D:\android-sdk-windows\platform-tools>adb shell test
test: permission denied
D:\android-sdk-windows\platform-tools>adb remount
remount failed: No such file or directory
Any ideas?有任何想法吗?
Do adb remount.做 adb 重新挂载。 And then try adb shell
然后尝试 adb shell
Solution for me was (thx to David Ljung Madison post )我的解决方案是(感谢David Ljung Madison 的帖子)
adb kill-server
adb kill-server
Run your cmd
as administrator this will solve my issues.以管理员身份运行您的
cmd
这将解决我的问题。 Thanks.谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.