参数配置

{
  "deviceName": "小米手机",
  "platformName": "android",
  "appPackage": "com.ren001.android",
  "appActivity": "....",
  "platformVersion": "8.0.0",
  "udid": "7ee8df2"
}

Appium 日志

[debug] [ADB] Running '/Users/maqiongke/import/android-sdk-macosx/platform-tools/adb' with args: ["-P",5037,"-s","7ee8df2","shell","pm","clear","com.xueqiu.android"][debug] [ADB] Running '/Users/maqiongke/import/android-sdk-macosx/platform-tools/adb' with args: ["-P",5037,"-s","7ee8df2","shell","pm","clear","com.xueqiu.android"][error] [ADB] Error: Cannot stop and clear com.xueqiu.android. Original error: Error executing adbExec. Original error: 'Command '/Users/maqiongke/import/android-sdk-macosx/platform-tools/adb -P 5037 -s 7ee8df2 shell pm clear com.xueqiu.android' exited with code 1'; Stderr: 'Error: java.lang.SecurityException: PID 11115 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.xueqiu.android'; Code: '1'
    at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:69:13)
    at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/adb-commands.js:347:9)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at <anonymous>
 Error: Cannot stop and clear com.xueqiu.android. Original error: Error executing adbExec. Original error: 'Command '/Users/maqiongke/import/android-sdk-macosx/platform-tools/adb -P 5037 -s 7ee8df2 shell pm clear com.xueqiu.android' exited with code 1'; Stderr: 'Error: java.lang.SecurityException: PID 11115 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.xueqiu.android'; Code: '1'
    at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:69:13)
    at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/adb-commands.js:347:9)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at <anonymous>
[debug] [AndroidDriver] Shutting down Android driver
[debug] [AndroidDriver] Called deleteSession but bootstrap wasn't active
[debug] [Logcat] Stopping logcat capture[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/maqiongke/import/android-sdk-macosx/platform-tools/adb' with args: ["-P",5037,"-s","7ee8df2","shell","am","force-stop","io.appium.unlock"]
[debug] [AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[error] [MJSONWP] Encountered internal error running command: Error: Cannot stop and clear com.xueqiu.android. Original error: Error executing adbExec. Original error: 'Command '/Users/maqiongke/import/android-sdk-macosx/platform-tools/adb -P 5037 -s 7ee8df2 shell pm clear com.xueqiu.android' exited with code 1'; Stderr: 'Error: java.lang.SecurityException: PID 11115 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.xueqiu.android'; Code: '1'
    at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:69:13)
    at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/adb-commands.js:347:9)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at <anonymous>
[info] [HTTP] <-- POST /wd/hub/session 500 9817 ms - 557 


↙↙↙阅读原文可查看相关链接,并与作者交流