Commit 311d371a authored by Dan Rubel's avatar Dan Rubel Committed by GitHub

display ANDROID_HOME env var in flutter doctor (#6558)

parent abb0a14a
......@@ -11,6 +11,8 @@ import '../base/common.dart';
import '../base/os.dart';
import '../globals.dart';
const String kAndroidHome = 'ANDROID_HOME';
// Android SDK layout:
// $ANDROID_HOME/platform-tools/adb
......@@ -58,8 +60,8 @@ class AndroidSdk {
static AndroidSdk locateAndroidSdk() {
String androidHomeDir;
if (Platform.environment.containsKey('ANDROID_HOME')) {
androidHomeDir = Platform.environment['ANDROID_HOME'];
if (Platform.environment.containsKey(kAndroidHome)) {
androidHomeDir = Platform.environment[kAndroidHome];
} else if (Platform.isLinux) {
if (homeDirPath != null)
androidHomeDir = '$homeDirPath/Android/Sdk';
......
......@@ -29,10 +29,18 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
String sdkVersionText;
if (androidSdk == null) {
if (Platform.environment.containsKey(kAndroidHome)) {
String androidHomeDir = Platform.environment[kAndroidHome];
messages.add(new ValidationMessage.error(
'$kAndroidHome = $androidHomeDir\n'
'but Android Studio / Android SDK not found at this location.'
));
} else {
messages.add(new ValidationMessage.error(
'Android Studio / Android SDK not found. Download from https://developer.android.com/sdk/\n'
'(or visit https://flutter.io/setup/#android-setup for detailed instructions).'
));
}
} else {
type = ValidationType.partial;
......@@ -47,6 +55,11 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
));
}
if (Platform.environment.containsKey(kAndroidHome)) {
String androidHomeDir = Platform.environment[kAndroidHome];
messages.add(new ValidationMessage('$kAndroidHome = $androidHomeDir'));
}
List<String> validationResult = androidSdk.validateSdkWellFormed();
if (validationResult.isEmpty) {
......
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