build.setResult(Result.NOT_BUILT);
return null;
}
// Confirm that the required SDK tools are available
AndroidSdk androidSdk = Utils.getAndroidSdk(launcher, androidHome, androidSdkHome);
if (androidSdk == null) {
if (!descriptor.shouldInstallSdk) {
// Couldn't find an SDK, don't want to install it, give up
log(logger, Messages.SDK_TOOLS_NOT_FOUND());
build.setResult(Result.NOT_BUILT);
return null;
}
// Ok, let's download and install the SDK
log(logger, Messages.INSTALLING_SDK());
try {
androidSdk = SdkInstaller.install(launcher, listener, androidSdkHome);
} catch (SdkInstallationException e) {
log(logger, Messages.SDK_INSTALLATION_FAILED(), e);
build.setResult(Result.NOT_BUILT);
return null;
}
} else if (descriptor.shouldKeepInWorkspace) {
SdkInstaller.optOutOfSdkStatistics(launcher, listener, androidSdkHome);
}
// Install the required SDK components for the desired platform, if necessary
if (descriptor.shouldInstallSdk) {
SdkInstaller.installDependencies(logger, launcher, androidSdk, emuConfig);
}
// Ok, everything looks good.. let's go
String displayHome = androidSdk.hasKnownRoot() ? androidSdk.getSdkRoot() : Messages.USING_PATH();
log(logger, Messages.USING_SDK(displayHome));
return doSetUp(build, launcher, listener, androidSdk, emuConfig, expandedProperties);
}