mirror of
https://github.com/appium/appium.git
synced 2026-05-04 17:29:28 -05:00
if installing a remote apk fails, uninstall/rm and retry (fix #2188)
This commit is contained in:
@@ -426,7 +426,7 @@ androidCommon.installApp = function (cb) {
|
||||
if (err) return cb(err);
|
||||
var install = function (err) {
|
||||
if (err) return cb(err);
|
||||
this.adb.installRemote(remoteApk, cb);
|
||||
this.installRemoteWithRetry(remoteApk, cb);
|
||||
}.bind(this);
|
||||
if (appExists) {
|
||||
install();
|
||||
@@ -444,6 +444,27 @@ androidCommon.installApp = function (cb) {
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
androidCommon.installRemoteWithRetry = function (remoteApk, cb) {
|
||||
this.adb.installRemote(remoteApk, function (err) {
|
||||
if (err) {
|
||||
logger.warn("Installing remote apk failed, going to uninstall and try " +
|
||||
"again");
|
||||
this.adb.uninstallApk(this.args.appPackage, function (err) {
|
||||
if (err) logger.warn("Uninstalling apk failed, continuing");
|
||||
this.removeTempApks([], function () {
|
||||
this.adb.push(this.args.app, remoteApk, function (err) {
|
||||
if (err) return cb(err);
|
||||
logger.info("Attempting to install again for the last time");
|
||||
this.adb.installRemote(remoteApk, cb);
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
androidCommon.getAppMd5 = function (cb) {
|
||||
md5(this.args.app, function (err, md5Hash) {
|
||||
if (err) return cb(err);
|
||||
|
||||
Reference in New Issue
Block a user