Package com.android.builder.sdk
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 TypeMethodDescriptiongetLocalEmulator(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>retrieveRepoIdsWithPrefix(SdkLibData sdkLibData, String prefix) 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 ifsdkLibData.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:
LicenceNotAcceptedExceptionInstallFailedException
-
getSdkInfo
Returns generic SDK information. This requires loading/parsing the SDK.- Parameters:
logger- a logger to output messages.- Returns:
- the sdk info.
-
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
Filerepresenting the locations to the directory where the Tool component is installed or null if we haven't managed to find such a component. - Throws:
LicenceNotAcceptedExceptionInstallFailedException
-
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
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.
-