From 48a8110bcb2a15b1627a216375dc2e6738e1f82f Mon Sep 17 00:00:00 2001 From: Payman Delshad Date: Tue, 25 Mar 2014 14:01:14 +0100 Subject: [PATCH] Make sure the app is always signed *before* getting the MD5 hash. --- lib/devices/android/android-common.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/devices/android/android-common.js b/lib/devices/android/android-common.js index 58f3dc250..a7d00e62f 100644 --- a/lib/devices/android/android-common.js +++ b/lib/devices/android/android-common.js @@ -401,14 +401,14 @@ androidCommon.installApp = function (cb) { return cb(); } - this.remoteApkExists(function (err, remoteApk) { - // err is set if the remote apk doesn't exist so don't check it. - this.adb.isAppInstalled(this.args.appPackage, function (err, installed) { - if (installed && this.args.fastReset && remoteApk) { - this.resetApp(cb); - } else if (!installed || (this.args.fastReset && !remoteApk)) { - this.adb.checkAndSignApk(this.args.app, this.args.appPackage, function (err) { - if (err) return cb(err); + this.adb.checkAndSignApk(this.args.app, this.args.appPackage, function (err) { + if (err) return cb(err); + this.remoteApkExists(function (err, remoteApk) { + // err is set if the remote apk doesn't exist so don't check it. + this.adb.isAppInstalled(this.args.appPackage, function (err, installed) { + if (installed && this.args.fastReset && remoteApk) { + this.resetApp(cb); + } else if (!installed || (this.args.fastReset && !remoteApk)) { this.adb.mkdir(this.remoteTempPath(), function (err) { if (err) return cb(err); this.getRemoteApk(function (err, remoteApk, md5Hash) { @@ -427,10 +427,10 @@ androidCommon.installApp = function (cb) { }.bind(this)); }.bind(this)); }.bind(this)); - }.bind(this)); - } else { - cb(); - } + } else { + cb(); + } + }.bind(this)); }.bind(this)); }.bind(this)); };