From 5d57eff61219b65b9786a7723cf3c0e527951d4c Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Wed, 22 Nov 2017 11:39:40 -0800 Subject: [PATCH] CB-13601: Fixing the standalone run scripts to make sure this works without using the CLI --- bin/templates/cordova/lib/build.js | 4 +++- bin/templates/cordova/lib/emulator.js | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js index c7aee307..a5299302 100644 --- a/bin/templates/cordova/lib/build.js +++ b/bin/templates/cordova/lib/build.js @@ -47,9 +47,11 @@ function parseOpts (options, resolvedTarget, projectRoot) { keystoreType: String }, {}, options.argv, 0); + + // Android Studio Build method is the default var ret = { buildType: options.release ? 'release' : 'debug', - buildMethod: process.env.ANDROID_BUILD || 'gradle', + buildMethod: process.env.ANDROID_BUILD || 'studio', prepEnv: options.argv.prepenv, arch: resolvedTarget && resolvedTarget.arch, extraArgs: [] diff --git a/bin/templates/cordova/lib/emulator.js b/bin/templates/cordova/lib/emulator.js index edb7c800..c8a1963d 100644 --- a/bin/templates/cordova/lib/emulator.js +++ b/bin/templates/cordova/lib/emulator.js @@ -432,7 +432,12 @@ module.exports.resolveTarget = function (target) { module.exports.install = function (givenTarget, buildResults) { var target; - var manifest = new AndroidManifest(path.join(__dirname, '../../AndroidManifest.xml')); + // We need to find the proper path to the Android Manifest + var manifestPath = path.join(__dirname, '..', '..', 'app', 'src', 'main', 'AndroidManifest.xml'); + if (buildResults.buildMethod === 'gradle') { + mainfestPath = path.join(__dirname, '../../AndroidManifest.xml'); + } + var manifest = new AndroidManifest(manifestPath); var pkgName = manifest.getPackageId(); // resolve the target emulator