Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS

OPPO/oneplus(一加)手机自动化调试时报错:

驱动异常->Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'D:\\Android\\android-sdk\\platform-tools\\adb.exe -P 5037 -s a9bb51b shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy'' exited with code 255'; Command output: Security exception: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS

解决方案:

在OPPO/oneplus(一加)的开发者选项配置中有一个配置项:

禁止权限监控

启用这个配置即可。

Failed to create session. Check https://github.com/appium/appium/issues/13802 for throubleshooting. Error executing adbExec. Original error: 'Command ''D:\tools\Android\Sdk\platform-tools\adb.exe' -P 5037 -s aae0a8e3 shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy'' exited with code 255'; Command output: Exception occurred while executing 'delete': java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2622) at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1565) at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1557) at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1528) at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:571) at android.content.ContentProvider.call(ContentProvider.java:2548) at android.content.ContentProvider$Transport.call(ContentProvider.java:538) at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:410) at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:284) at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97) at android.os.ShellCommand.exec(ShellCommand.java:38) at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51) at android.os.Binder.shellCommand(Binder.java:1073) at android.os.Binder.onTransact(Binder.java:901) at android.os.Binder.execTransactInternal(Binder.java:1331) at android.os.Binder.execTransact(Binder.java:1268) Exception occurred while executing 'delete': java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2622) at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1565) at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1557) at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1528) at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:571) at android.content.ContentProvider.call(ContentProvider.java:2548) at android.content.ContentProvider$Transport.call(ContentProvider.java:538) at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:410) at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:284) at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97) at android.os.ShellCommand.exec(ShellCommand.java:38) at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51) at android.os.Binder.shellCommand(Binder.java:1073) at android.os.Binder.onTransact(Binder.java:901) at android.os.Binder.execTransactInternal(Binder.java:1331) at android.os.Binder.execTransact(Binder.java:1268) Exception occurred while executing 'delete': java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2622) at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1565) at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1557) at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1528) at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:571) at android.content.ContentProvider.call(ContentProvider.java:2548) at android.content.ContentProvider$Transport.call(ContentProvider.java:538) at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:410) at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:284) at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97) at android.os.ShellCommand.exec(ShellCommand.java:38) at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51) at android.os.Binder.shellCommand(Binder.java:1073) at android.os.Binder.onTransact(Binder.java:901) at android.os.Binder.execTransactInternal(Binder.java:1331) at android.os.Binder.execTransact(Binder.java:1268)
最新发布
10-09
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值