diff --git a/lib/check_reqs.js b/lib/check_reqs.js index d9558090ba..22414a6deb 100644 --- a/lib/check_reqs.js +++ b/lib/check_reqs.js @@ -24,7 +24,7 @@ const { forgivingWhichSync, isWindows, isDarwin } = require('./utils'); const java = require('./env/java'); const { CordovaError, ConfigParser, events } = require('cordova-common'); const android_sdk = require('./android_sdk'); -const { SDK_VERSION, COMPILE_SDK_VERSION } = require('./gradle-config-defaults'); +const { SDK_VERSION } = require('./gradle-config-defaults'); // Re-exporting these for backwards compatibility and for unit testing. // TODO: Remove uses and use the ./utils module directly. @@ -50,7 +50,7 @@ module.exports.get_target = function (projectRoot) { */ module.exports.get_compile = function (projectRoot) { const userTargetSdkVersion = getUserTargetSdkVersion(projectRoot) || SDK_VERSION; - const userCompileSdkVersion = getUserCompileSdkVersion(projectRoot) || COMPILE_SDK_VERSION; + const userCompileSdkVersion = getUserCompileSdkVersion(projectRoot) || userTargetSdkVersion; module.exports.isCompileSdkValid(userCompileSdkVersion, userTargetSdkVersion); @@ -58,8 +58,8 @@ module.exports.get_compile = function (projectRoot) { }; module.exports.isCompileSdkValid = (compileSdk, targetSdk) => { - compileSdk = (compileSdk || COMPILE_SDK_VERSION); targetSdk = (targetSdk || SDK_VERSION); + compileSdk = (compileSdk || targetSdk); const isValid = compileSdk >= targetSdk; if (!isValid) {