Appium 1.4.13在Android 7上有bug
報錯:Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without firstuninstalling.]
原解決方案見:https://discuss.appium.io/t/support-version-android-n/10206/5
總結自己的解決方案:
原因:
1. adb.js 中1035 行this.shell("ps '" + name + "'", function (err, stdout) {
對應執(zhí)行的指令是ps 'uiautomator', Android7不支持這個指令格式,所以執(zhí)行結果是bad pid'uiautomator'
目前Appium未對此進行處理,所以需要修改此指令的執(zhí)行方式
即將
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);
};