anchor.diff:            '(or visit https://flutter.io/setup/#android-setup for detailed instructions).'
           ));
         }
  -    } else {
  -      type = ValidationType.partial;
   
  -      messages.add(new ValidationMessage('Android SDK at ${androidSdk.directory}'));
  +      return new ValidationResult(ValidationType.missing, messages);
  +    }
   
  -      if (androidSdk.latestVersion != null) {
  -        sdkVersionText = 'Android SDK ${androidSdk.latestVersion.buildToolsVersionName}';
  +    messages.add(new ValidationMessage('Android SDK at ${androidSdk.directory}'));
   
  -        messages.add(new ValidationMessage(
  -          'Platform ${androidSdk.latestVersion.platformVersionName}, '
  -          'build-tools ${androidSdk.latestVersion.buildToolsVersionName}'
  -        ));
  -      }
  +    String sdkVersionText;
  +    if (androidSdk.latestVersion != null) {
  +      sdkVersionText = 'Android SDK ${androidSdk.latestVersion.buildToolsVersionName}';
   
  -      if (platform.environment.containsKey(kAndroidHome)) {
  -        final String androidHomeDir = platform.environment[kAndroidHome];
  -        messages.add(new ValidationMessage('$kAndroidHome = $androidHomeDir'));
  -      }
  +      messages.add(new ValidationMessage(
  +        'Platform ${androidSdk.latestVersion.platformVersionName}, '
  +        'build-tools ${androidSdk.latestVersion.buildToolsVersionName}'
  +      ));
  +    }
   
  -      final List<String> validationResult = androidSdk.validateSdkWellFormed();
  +    if (platform.environment.containsKey(kAndroidHome)) {
  +      final String androidHomeDir = platform.environment[kAndroidHome];
  +      messages.add(new ValidationMessage('$kAndroidHome = $androidHomeDir'));
  +    }
   
  -      if (validationResult.isEmpty) {
  -        // Empty result means SDK is well formed.
  -        // The SDK also requires a valid Java JDK installation.
  -        const String _kJdkDownload = 'https://www.oracle.com/technetwork/java/javase/downloads/';
  -        String javaVersion;
  +    final List<String> validationResult = androidSdk.validateSdkWellFormed();
   
  -        try {
  -          printTrace('java -version');
  -
  -          final ProcessResult result = processManager.runSync(<String>['java', '-version']);
  -          if (result.exitCode == 0) {
  -            javaVersion = result.stderr;
  -            final List<String> versionLines = javaVersion.split('\n');
  -            javaVersion = versionLines.length >= 2 ? versionLines[1] : versionLines[0];
  -           }
  -        } catch (error) {
  -        }
  -
  -        if (javaVersion == null) {
  -          messages.add(new ValidationMessage.error(
  -              'No Java Development Kit (JDK) found; you can download the JDK from $_kJdkDownload.'
  -          ));
  -        } else {
  -          messages.add(new ValidationMessage(javaVersion));
  -          type = ValidationType.installed;
  -        }
  -      } else {
  -        messages.addAll(validationResult.map((String message) {
  -          return new ValidationMessage.error(message);
  -        }));
  -        messages.add(new ValidationMessage(
  +    if (validationResult.isNotEmpty) {
  +      // Android SDK is not functional.
  +      messages.addAll(validationResult.map((String message) {
  +        return new ValidationMessage.error(message);
  +      }));
  +      messages.add(new ValidationMessage(
             'Try re-installing or updating your Android SDK,\n'
             'visit https://flutter.io/setup/#android-setup for detailed instructions.'));
  -      }
  +      return new ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
       }
   
  -    return new ValidationResult(type, messages, statusInfo: sdkVersionText);
  +    // Now check for the JDK.
  +    final String javaBinary = _findJavaBinary();
  +    if (javaBinary == null) {
  +      messages.add(new ValidationMessage.error(
  +          'No Java Development Kit (JDK) found; You must have the environment '
  +          'variable JAVA_HOME set and the java binary in your PATH. '
  +          'You can download the JDK from $_kJdkDownload.'));
  +      return new ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
  +    }
  +    messages.add(new ValidationMessage('Java binary at: $javaBinary'));
  +
  +    // Check JDK version.
  +    if (!_checkJavaVersion(javaBinary, messages)) {
  +      return new ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
  +    }
  +
  +    // Success.
  +    return new ValidationResult(ValidationType.installed, messages, statusInfo: sdkVersionText);
     }
   }
  
positive.code:   @override
    bool get canLaunchDevices => androidSdk != null && androidSdk.validateSdkWellFormed().isEmpty;
  
    @override
    Future<ValidationResult> validate() async {
      final List<ValidationMessage> messages = <ValidationMessage>[];
      ValidationType type = ValidationType.missing;
      String sdkVersionText;
  
      if (androidSdk == null) {
        if (platform.environment.containsKey(kAndroidHome)) {
          final String androidHomeDir = platform.environment[kAndroidHome];
          messages.add(new ValidationMessage.error(
  
negative.code: import 'dart:async';
  
  import '../base/io.dart';
  import '../base/file_system.dart';
  import '../base/os.dart';
  import '../base/platform.dart';
  import '../base/process.dart';
  import '../base/process_manager.dart';
  import '../doctor.dart';
  import '../globals.dart';
  