code: public void validate() {
          // check if android build tool version is at least minimal required version
          Revision revBuildToolsVersion = Revision.parseRevision(buildToolsVersion);
          if (minimalBuildToolsVersion.compareTo(revBuildToolsVersion) > 0) {
              throw new GradleException("Android buildToolsVersion should be at least version " + minimalBuildToolsVersion + ": currently using " + buildToolsVersion + " from " + buildToolsDir + ". See https://developer.android.com/studio/intro/update.html on how to update the build tools in the Android SDK.");
          }
  
          // check if valid android build tools exists
          if (!project.file(buildToolsDir + "/aapt").exists() &&
                  !project.file(buildToolsDir + "/aapt.exe").exists()) {
              throw new GradleException("Configured buildToolsVersion is invalid: " + buildToolsVersion + " (" + buildToolsDir + ")");
          }
  
          // check if android platform exists
          if (!project.file(androidSdk + "/platforms/android-" + compileSdkVersion).exists()) {
              throw new GradleException("Configured compileSdkVersion is invalid: " + compileSdkVersion + " (" + androidSdk + "/platforms/android-" + compileSdkVersion + ")");
          }
  
  //        sdkHandler.initTarget(AndroidTargetHash.getPlatformHashString(new AndroidVersion(Integer.parseInt(compileSdkVersion))),
  //                getBuildToolsRevision(), Collections.emptyList(), androidBuilder, false);
  
          sdkHandler.ensurePlatformToolsIsInstalled(extraModelInfo);
      }
docs: Checks whether the properties on the android extension are valid after
  everything was configured.