Appium执行自动化报错android.permission.WRITE_SECURE_SETTINGS

2021-09-15 17:48:05 浏览数 (1)

APP执行自动化,启动报错

错误:

WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'C:\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 38ffe7ac shell settings delete global hidden_api_policy_pre_p_apps' exited with code 4294967295'; Stderr: 'Security exception: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS

java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS

at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2340)

at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1405)

at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1388)

at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:603)

at android.content.ContentProvider.call(ContentProvider.java:2162)

at android.content.ContentProvider$Transport.call(ContentProvider.java:481)

at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:399)

at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:281)

at android.os.ShellCommand.exec(ShellCommand.java:104)

at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:49)

at android.os.Binder.shellCommand(Binder.java:881)

at android.os.Binder.onTransact(Binder.java:765)

at android.os.Binder.execTransactInternal(Binder.java:1021)

at android.os.Binder.execTransact(Binder.java:994)'; Code: '4294967295'

前提:

1、打开开发者选项

(1)进入手机设置后,往下翻找到【关于手机】点击进入。

(2)进入关于手机,找到【版本号】连续点击10次左右,即可开启开发者选项。

2、允许

(1)手机【设置】,找到【其他设置】,点击进入,在页面底端附近找到【开发者选项】。

(2)进入【开发者选项】,打开【USB调试】

解决:

3、打开android安全设置

小米:在开发者选项里,把“USB调试(安全设置)"打开即可,允许USB调试修改权限或模拟点击。

oppo:在开发者选项里,把"禁止权限监控"打开即可。

0 人点赞