Skip to content

Commit cfaa882

Browse files
author
Ben Delaney
authored
feat(doctor): more informative android compile SDK messages (#5697)
1 parent a5bbac7 commit cfaa882

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/doctor/src/android-tools-info.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ export class AndroidToolsInfo implements NativeScriptDoctor.IAndroidToolsInfo {
9898
const errors: NativeScriptDoctor.IWarning[] = [];
9999
const toolsInfoData = this.getToolsInfo(config);
100100
const isAndroidHomeValid = this.isAndroidHomeValid();
101-
const supportsOnlyMinRequiredCompileTarget =
102-
this.getMaxSupportedCompileVersion(config) ===
103-
AndroidToolsInfo.MIN_REQUIRED_COMPILE_TARGET;
104-
105101
if (!toolsInfoData.compileSdkVersion) {
102+
const supportedTargetsForAndroidRuntime = this.getSupportedTargets(config.projectDir)
106103
errors.push({
107-
warning: `Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK ${
108-
AndroidToolsInfo.MIN_REQUIRED_COMPILE_TARGET
109-
}${supportsOnlyMinRequiredCompileTarget ? "" : " or later"}.`,
104+
warning: [
105+
`Cannot find a compatible Android SDK for compilation.`,
106+
`To be able to build for Android with your current android runtime, install one of the following supported Android SDK targets:`,
107+
...supportedTargetsForAndroidRuntime.map(target => ` ${target}`),
108+
`Supported targets vary based on what android runtime you have installed. Currently your app uses @nativescript/android ${this.getRuntimeVersion({ projectDir: config.projectDir })}`
109+
].join('\n'),
110110
additionalInformation: `Run \`\$ ${this.getPathToSdkManagementTool()}\` to manage your Android SDK versions.`,
111111
platforms: [Constants.ANDROID_PLATFORM_NAME],
112112
});

0 commit comments

Comments
 (0)