You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by da...@apache.org on 2016/03/18 08:30:49 UTC
android commit: CB-10600 'cordova run android --release' does not use
signed and zip-aligned version of APK
Repository: cordova-android
Updated Branches:
refs/heads/master 457c5b8b3 -> bc9e895e2
CB-10600 'cordova run android --release' does not use signed and zip-aligned version of APK
De-prioritize unsigned builds
Adds an actionable hint for INSTALL_PARSE_FAILED_NO_CERTIFICATES error
Removes filtering by architecture when not specified
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/bc9e895e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/bc9e895e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/bc9e895e
Branch: refs/heads/master
Commit: bc9e895e2537f212756eb8e18559fac2cb02c536
Parents: 457c5b8
Author: daserge <v-...@microsoft.com>
Authored: Wed Mar 16 16:54:06 2016 +0300
Committer: daserge <v-...@microsoft.com>
Committed: Fri Mar 18 08:59:59 2016 +0300
----------------------------------------------------------------------
bin/templates/cordova/lib/Adb.js | 8 +++++++-
bin/templates/cordova/lib/builders/GenericBuilder.js | 11 ++++++++++-
bin/templates/cordova/lib/emulator.js | 10 ++++++++--
3 files changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bc9e895e/bin/templates/cordova/lib/Adb.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/Adb.js b/bin/templates/cordova/lib/Adb.js
index 98cd990..ec3f315 100644
--- a/bin/templates/cordova/lib/Adb.js
+++ b/bin/templates/cordova/lib/Adb.js
@@ -63,8 +63,14 @@ Adb.install = function (target, packagePath, opts) {
.then(function(output) {
// 'adb install' seems to always returns no error, even if installation fails
// so we catching output to detect installation failure
- if (output.match(/Failure/))
+ if (output.match(/Failure/)) {
+ if (output.match(/INSTALL_PARSE_FAILED_NO_CERTIFICATES/)) {
+ output += '\n\n' + 'Sign the build using \'-- --keystore\' or \'--buildConfig\'' +
+ ' or sign and deploy the unsigned apk manually using Android tools.';
+ }
+
return Q.reject(new CordovaError('Failed to install apk to device: ' + output));
+ }
});
};
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bc9e895e/bin/templates/cordova/lib/builders/GenericBuilder.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/builders/GenericBuilder.js b/bin/templates/cordova/lib/builders/GenericBuilder.js
index 6363b29..362da43 100644
--- a/bin/templates/cordova/lib/builders/GenericBuilder.js
+++ b/bin/templates/cordova/lib/builders/GenericBuilder.js
@@ -93,6 +93,14 @@ GenericBuilder.prototype.extractRealProjectNameFromManifest = function () {
module.exports = GenericBuilder;
function apkSorter(fileA, fileB) {
+ // De-prioritize unsigned builds
+ var unsignedRE = /-unsigned/;
+ if (unsignedRE.exec(fileA)) {
+ return 1;
+ } else if (unsignedRE.exec(fileB)) {
+ return -1;
+ }
+
var timeDiff = fs.statSync(fileA).mtime - fs.statSync(fileB).mtime;
return timeDiff === 0 ? fileA.length - fileB.length : timeDiff;
}
@@ -128,7 +136,8 @@ function findOutputApksHelper(dir, build_type, arch) {
return !!/-x86|-arm/.exec(path.basename(p)) == archSpecific;
/*jshint +W018 */
});
- if (archSpecific && ret.length > 1) {
+
+ if (archSpecific && ret.length > 1 && arch) {
ret = ret.filter(function(p) {
return path.basename(p).indexOf('-' + arch) != -1;
});
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bc9e895e/bin/templates/cordova/lib/emulator.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/emulator.js b/bin/templates/cordova/lib/emulator.js
index 1a07236..28c93f5 100644
--- a/bin/templates/cordova/lib/emulator.js
+++ b/bin/templates/cordova/lib/emulator.js
@@ -368,8 +368,14 @@ module.exports.install = function(givenTarget, buildResults) {
if (err) reject(new CordovaError('Error executing "' + command + '": ' + stderr));
// adb does not return an error code even if installation fails. Instead it puts a specific
// message to stdout, so we have to use RegExp matching to detect installation failure.
- else if (/Failure/.test(stdout)) reject(new CordovaError('Failed to install apk to emulator: ' + stdout));
- else resolve(stdout);
+ else if (/Failure/.test(stdout)) {
+ if (stdout.match(/INSTALL_PARSE_FAILED_NO_CERTIFICATES/)) {
+ stdout += 'Sign the build using \'-- --keystore\' or \'--buildConfig\'' +
+ ' or sign and deploy the unsigned apk manually using Android tools.';
+ }
+
+ reject(new CordovaError('Failed to install apk to emulator: ' + stdout));
+ } else resolve(stdout);
});
});
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org