appium 在安卓7.0的手機上運行上報錯---------Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]
解決方法:
進入Appium安裝目錄,找到目錄下的adb.js(D:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js)
adb.js 中1035 行(出錯原因:this.shell("ps '" + name + "'", function (err, stdout) {對應執行的指令是ps 'uiautomator', Android7不支持這個指令格式,所以執行結果是bad pid 'uiautomator')
this.shell("ps '" + name + "'", function (err, stdout) { if (err) return cb(err); 替換成 this.shell_grep("ps", name, function (err, stdout) { if (err) { logger.debug("No matching processes found"); return cb(null, []); } 並增加上面用到的shell_grep函數: ADB.prototype.shell_grep = function (cmd, grep, cb) { if (cmd.indexOf('"') === -1) { cmd = '"' + cmd + '"'; } var execCmd = 'shell ' + cmd + '| grep ' + grep; this.exec(execCmd, cb); };