Github user filmaj commented on a diff in the pull request: https://github.com/apache/cordova-android/pull/367#discussion_r105241092 --- Diff: bin/lib/check_reqs.js --- @@ -78,21 +79,46 @@ module.exports.check_ant = function() { }); }; +module.exports.get_gradle_wrapper = function() { + var androidStudioPath; + if(os.platform() == "darwin") { + androidStudioPath = path.join('/Applications', 'Android Studio.app', 'Contents', 'gradle'); + } else if (os.platform() == "win32") { + androidStudioPath = path.join(process.env["ProgramFiles"],'Android', 'Android Studio', 'gradle'); + } + + if(androidStudioPath != null && fs.existsSync(androidStudioPath)) { + var dirs = fs.readdirSync(androidStudioPath); + if(dirs[0].split('-')[0] == "gradle") + { + return path.join(androidStudioPath, dirs[0], "bin", "gradle"); + } + } else { + //OK, let's try to check for Gradle! + return forgivingWhichSync('gradle'); + } +}; + // Returns a promise. Called only by build and clean commands. module.exports.check_gradle = function() { var sdkDir = process.env['ANDROID_HOME']; + var d = Q.defer(); if (!sdkDir) return Q.reject(new CordovaError('Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.\n' + 'Might need to install Android SDK or set up \'ANDROID_HOME\' env variable.')); - var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper'); - if (!fs.existsSync(wrapperDir)) { - return Q.reject(new CordovaError('Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.\n' + - 'Looked here: ' + wrapperDir)); - } - return Q.when(); + var path = this.get_gradle_wrapper(); + console.log(path); --- End diff -- Probably want to remove this console.log?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org