Unverified Commit 1058cff3 authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Add version check for doctor --android-licenses (#14249)

flutter doctor --android-licenses requires Android sdkmanager version 26
or later. When sdkmanager is not available (SDKs earlier than v25),
direct users to SDK upgrade instructions. When it's installed but not
v26 or later, emit instructions to run sdkmanager --update.
parent 538ba522
......@@ -4,6 +4,7 @@
import 'dart:async';
import '../base/common.dart';
import '../base/context.dart';
import '../base/file_system.dart';
import '../base/io.dart';
......@@ -12,6 +13,7 @@ import '../base/platform.dart';
import '../base/process.dart';
import '../base/process_manager.dart';
import '../base/utils.dart';
import '../base/version.dart';
import '../doctor.dart';
import '../globals.dart';
import 'android_sdk.dart';
......@@ -186,6 +188,21 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
fs.path.dirname(javaBinary) + os.pathVarSeparator + platform.environment['PATH'];
}
if (!processManager.canRun(androidSdk.sdkManagerPath))
throwToolExit(
'Android sdkmanager tool not found.\n'
'Try re-installing or updating your Android SDK,\n'
'visit https://flutter.io/setup/#android-setup for detailed instructions.'
);
final Version sdkManagerVersion = new Version.parse(androidSdk.sdkManagerVersion);
if (sdkManagerVersion.major < 26)
// SDK manager is found, but needs to be updated.
throwToolExit(
'A newer version of the Android SDK is required. To update, run:\n'
'${androidSdk.sdkManagerPath} --update\n'
);
final Process process = await runCommand(
<String>[androidSdk.sdkManagerPath, '--licenses'],
environment: sdkManagerEnv,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment