diff --git a/lib/common b/lib/common index dcdddcee7c..c8562dc52a 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit dcdddcee7c23f40e34b59840ac7f29f6d1b14539 +Subproject commit c8562dc52a6f9e051eda7de5bee9a9e2b3d458c3 diff --git a/lib/services/doctor-service.ts b/lib/services/doctor-service.ts index 5044c3f319..9fe6802a25 100644 --- a/lib/services/doctor-service.ts +++ b/lib/services/doctor-service.ts @@ -66,7 +66,7 @@ class DoctorService implements IDoctorService { result = true; } - if(sysInfo.gradleVer && helpers.versionCompare(sysInfo.gradleVer, DoctorService.MIN_SUPPORTED_GRADLE_VERSION) === -1) { + if(sysInfo.gradleVer && !this.isGradleVersionSupported(sysInfo.gradleVer)) { this.$logger.warn(`WARNING: Gradle version is lower than ${DoctorService.MIN_SUPPORTED_GRADLE_VERSION}.`); this.$logger.out("You will not be able to build your projects for Android or run them in the emulator or on a connected device." + EOL + `To be able to build for Android and run apps in the emulator or on a connected device, verify that you have at least ${DoctorService.MIN_SUPPORTED_GRADLE_VERSION} version installed.`); @@ -106,5 +106,14 @@ class DoctorService implements IDoctorService { this.$logger.out("TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies." + EOL); } } + + private isGradleVersionSupported(gradleVersion: string): boolean { + let minSupportedVersion = DoctorService.MIN_SUPPORTED_GRADLE_VERSION; + let requiredLength = _.max([gradleVersion.split(".").length, minSupportedVersion.split(".").length]); + gradleVersion = helpers.appendZeroesToVersion(gradleVersion, requiredLength); + minSupportedVersion = helpers.appendZeroesToVersion(minSupportedVersion, requiredLength); + + return helpers.versionCompare(gradleVersion, minSupportedVersion) !== -1; + } } $injector.register("doctorService", DoctorService);