Appium运行时报does not have permission android.permission.CLEAR_APP_USER_DATA to clear data
在oppo R11 操作系统:Android8.1.0手机上运行h5 ui自动化用例时,报错:An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command '/Users/amoliu/android/android-sdk_r24.4.1-macosx/platform-tools/adb -P 5037 -s 3cb2dc77 shell pm clear com.xiaomi.shop' exited with code 1'; Stderr: 'Error: java.lang.SecurityException: PID 22474 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.xiaomi.shop'; Code: '1'
尝试后2种方法可解决:
1)增加配置项noReset=true
2)除了常见开发者选项中打开usb调试,同时还需要开启以下2项,然后重启手机即可