Skip to content

feat: more informative android compile SDK messages #5697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/doctor/src/android-tools-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ export class AndroidToolsInfo implements NativeScriptDoctor.IAndroidToolsInfo {
const errors: NativeScriptDoctor.IWarning[] = [];
const toolsInfoData = this.getToolsInfo(config);
const isAndroidHomeValid = this.isAndroidHomeValid();
const supportsOnlyMinRequiredCompileTarget =
this.getMaxSupportedCompileVersion(config) ===
AndroidToolsInfo.MIN_REQUIRED_COMPILE_TARGET;

if (!toolsInfoData.compileSdkVersion) {
const supportedTargetsForAndroidRuntime = this.getSupportedTargets(config.projectDir)
errors.push({
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"}.`,
warning: [
`Cannot find a compatible Android SDK for compilation.`,
`To be able to build for Android with your current android runtime, install one of the following supported Android SDK targets:`,
...supportedTargetsForAndroidRuntime.map(target => ` ${target}`),
`Supported targets vary based on what android runtime you have installed. Currently your app uses @nativescript/android ${this.getRuntimeVersion({ projectDir: config.projectDir })}`
].join('\n'),
additionalInformation: `Run \`\$ ${this.getPathToSdkManagementTool()}\` to manage your Android SDK versions.`,
platforms: [Constants.ANDROID_PLATFORM_NAME],
});
Expand Down