Interface SdkLoader

All Known Implementing Classes:
DefaultSdkLoader, PlatformLoader

public interface SdkLoader
A loader for the SDK. It's able to provide general SDK information (getSdkInfo(com.android.utils.ILogger), or getRepositories()), or target-specific information (getTargetInfo(String, Revision, com.android.utils.ILogger, SdkLibData)).
  • Method Summary

    Modifier and Type
    Method
    Description
    getLocalEmulator(com.android.utils.ILogger logger)
    Retrieves the local emulator repository if it exists.
    com.google.common.collect.ImmutableList<File>
    Returns the location of artifact repositories built-in the SDK.
    getSdkInfo(com.android.utils.ILogger logger)
    Returns generic SDK information.
    getTargetInfo(String targetHash, com.android.repository.Revision buildToolRevision, com.android.utils.ILogger logger, SdkLibData sdkLibData)
    Returns information about a build target.
    installSdkTool(SdkLibData sdkLibData, String packageId)
    Installs an Android Sdk Tool if it's not already installed.
    com.google.common.collect.ImmutableList<String>
    Retrieves the hash ids for available remote repositories that start with the given prefix.
  • Method Details

    • getTargetInfo

      @NonNull TargetInfo getTargetInfo(@NonNull String targetHash, @NonNull com.android.repository.Revision buildToolRevision, @NonNull com.android.utils.ILogger logger, @NonNull SdkLibData sdkLibData) throws LicenceNotAcceptedException, InstallFailedException
      Returns information about a build target. Potentially downloads SDK components if sdkLibData.useSdlDownload() is true. This requires loading/parsing the SDK.
      Parameters:
      targetHash - the compilation target hash string.
      buildToolRevision - the build tools revision.
      logger - a logger to output messages.
      sdkLibData - a wrapper containing all the components for downloading.
      Returns:
      the target info.
      Throws:
      LicenceNotAcceptedException
      InstallFailedException
    • getSdkInfo

      @NonNull SdkInfo getSdkInfo(@NonNull com.android.utils.ILogger logger)
      Returns generic SDK information. This requires loading/parsing the SDK.
      Parameters:
      logger - a logger to output messages.
      Returns:
      the sdk info.
    • getRepositories

      @NonNull com.google.common.collect.ImmutableList<File> getRepositories()
      Returns the location of artifact repositories built-in the SDK.
      Returns:
      a non null list of repository folders.
    • installSdkTool

      @Nullable File installSdkTool(@NonNull SdkLibData sdkLibData, @NonNull String packageId) throws LicenceNotAcceptedException, InstallFailedException
      Installs an Android Sdk Tool if it's not already installed.
      Parameters:
      sdkLibData - contains all the components for downloading.
      packageId - the package/id path of the required Tool component.
      Returns:
      a File representing the locations to the directory where the Tool component is installed or null if we haven't managed to find such a component.
      Throws:
      LicenceNotAcceptedException
      InstallFailedException
    • retrieveRepoIdsWithPrefix

      @Nullable com.google.common.collect.ImmutableList<String> retrieveRepoIdsWithPrefix(@NonNull SdkLibData sdkLibData, @NonNull String prefix)
      Retrieves the hash ids for available remote repositories that start with the given prefix.
      Parameters:
      sdkLibData - contains all the components for downloading.
      prefix - the prefix for repo hash ids to be retrieved
      Returns:
      a list of hash ids for all remote reps available or null if we are unable to reach the remote server (such as being offline).
    • getLocalEmulator

      @Nullable File getLocalEmulator(@NonNull com.android.utils.ILogger logger)
      Retrieves the local emulator repository if it exists.

      If the emulator is missing, null is returned. No effort is made to update or install the emulator as this can invalidate existing avd snapshots.

      Returns:
      The location of the emulator, or null if it is not installed.