display ANDROID_HOME env var in flutter doctor (#6558)
This commit is contained in:
@@ -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) {
|
||||
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).'
|
||||
));
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user