【Appium踩坑】settings delete global hidden_api_policy exited with code 20 Can‘t find service: settings

1、解决-重启adb服务

(adb相关的报错,基本都可以试试重启服务,重启大法向来好使!)

adb kill-server
adb start-server
2、完整报错
E   selenium.common.exceptions.WebDriverException: Message: 
An unknown server-side error occurred while processing the command. 
Original error: Error executing adbExec. Original error: 
'Command '/Users/tf1/Library/Android/sdk/platform-tools/adb -P 5037 -s 3158044531001O3 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 20'; Command output: cmd: Can't find service: settings
E   cmd: Can't find service: settings
E   cmd: Can't find service: settings
E
E   Stacktrace:
E   UnknownError: An unknown server-side error occurred while processing the command. 
Original error: Error executing adbExec. Original error: 
'Command '/Users/tf1/Library/Android/sdk/platform-tools/adb -P 5037 -s 3158044531001O3 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 20'; Command output: cmd: Can't find service: settings
E   cmd: Can't find service: settings
E   cmd: Can't find service: settings
E
E       at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
E       at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)