Skip to content

Commit 3f52530

Browse files
authored
Merge pull request #55 from NativeScript/kddimitrov/fix-compile-sdk-warning
fix: runtime supports sdk 28 only and user has 29 or no sdk, doctor prints wrong message
2 parents 065325f + 7e111a1 commit 3f52530

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/android-tools-info.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ export class AndroidToolsInfo implements NativeScriptDoctor.IAndroidToolsInfo {
6969
const errors: NativeScriptDoctor.IWarning[] = [];
7070
const toolsInfoData = this.getToolsInfo(config);
7171
const isAndroidHomeValid = this.isAndroidHomeValid();
72+
const runtimeVersion = this.getRuntimeVersion(config);
73+
const supportsOnlyMinRequiredCompileTarget = this.getMaxSupportedCompileVersion(runtimeVersion) === AndroidToolsInfo.MIN_REQUIRED_COMPILE_TARGET;
7274
if (!toolsInfoData.compileSdkVersion) {
7375
errors.push({
74-
warning: `Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK ${AndroidToolsInfo.MIN_REQUIRED_COMPILE_TARGET} or later.`,
76+
warning: `Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK ${AndroidToolsInfo.MIN_REQUIRED_COMPILE_TARGET}${supportsOnlyMinRequiredCompileTarget ? "" : " or later"}.`,
7577
additionalInformation: `Run \`\$ ${this.getPathToSdkManagementTool()}\` to manage your Android SDK versions.`,
7678
platforms: [Constants.ANDROID_PLATFORM_NAME]
7779
});
@@ -398,4 +400,12 @@ export class AndroidToolsInfo implements NativeScriptDoctor.IAndroidToolsInfo {
398400

399401
return runtimeVersion;
400402
}
403+
404+
private getMaxSupportedCompileVersion(runtimeVersion: string): number {
405+
if (runtimeVersion && semver.lt(semver.coerce(runtimeVersion), "6.1.0")) {
406+
return 28;
407+
}
408+
409+
return this.parseAndroidSdkString(_.last(this.getSupportedTargets(runtimeVersion).sort()));
410+
}
401411
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-doctor",
3-
"version": "1.11.0",
3+
"version": "1.11.1",
44
"description": "Library that helps identifying if the environment can be used for development of {N} apps.",
55
"main": "lib/index.js",
66
"types": "./typings/nativescript-doctor.d.ts",

0 commit comments

Comments
 (0)