From 8cd6d2a3826824b5cc954de5c8cd6f9b9222d1a3 Mon Sep 17 00:00:00 2001 From: shyam Date: Fri, 11 Apr 2014 17:41:47 -0400 Subject: [PATCH] ApkSigning when using custome keystore fails ApkSigning fails when using a custom keystore. Looking into the logs I realized that the options to the jarsigner command are not in the right order. Once I made this change the signing went ahead as expected. --- lib/devices/android/adb.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/devices/android/adb.js b/lib/devices/android/adb.js index fddc043ad..c8ebfd93c 100644 --- a/lib/devices/android/adb.js +++ b/lib/devices/android/adb.js @@ -406,12 +406,13 @@ ADB.prototype.signWithCustomCert = function (apk, cb) { return cb(new Error("Keystore doesn't exist. " + this.keystorePath)); } - var sign = [jarsigner, '"' + apk + '"', + var sign = [jarsigner, '-sigalg MD5withRSA', '-digestalg SHA1', '-keystore "' + this.keystorePath + '"', '-storepass "' + this.keystorePassword + '"', '-keypass "' + this.keyPassword + '"', + '"' + apk + '"', '"' + this.keyAlias + '"'].join(' '); logger.debug("Unsigning apk with: " + unsign); exec(unsign, { maxBuffer: 524288 }, function (err, stdout, stderr) {