Package com.android.builder.sdk
Class DefaultSdkLoader
java.lang.Object
com.android.builder.sdk.DefaultSdkLoader
- All Implemented Interfaces:
SdkLoader
Singleton-based implementation of SdkLoader for a standard SDK
-
Method Summary
Modifier and TypeMethodDescriptionstatic SdkLoadergetLocalEmulator(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.static voidunload()
-
Method Details
-
getLoader
-
unload
public static void unload() -
getTargetInfo
@NonNull public TargetInfo getTargetInfo(@NonNull String targetHash, @NonNull com.android.repository.Revision buildToolRevision, @NonNull com.android.utils.ILogger logger, @NonNull SdkLibData sdkLibData) throws LicenceNotAcceptedException, InstallFailedException Description copied from interface:SdkLoaderReturns information about a build target. Potentially downloads SDK components ifsdkLibData.useSdlDownload()is true. This requires loading/parsing the SDK.- Specified by:
getTargetInfoin interfaceSdkLoader- 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
Description copied from interface:SdkLoaderReturns generic SDK information. This requires loading/parsing the SDK.- Specified by:
getSdkInfoin interfaceSdkLoader- Parameters:
logger- a logger to output messages.- Returns:
- the sdk info.
-
getRepositories
Description copied from interface:SdkLoaderReturns the location of artifact repositories built-in the SDK.- Specified by:
getRepositoriesin interfaceSdkLoader- Returns:
- a non null list of repository folders.
-
installSdkTool
@Nullable public File installSdkTool(@NonNull SdkLibData sdkLibData, @NonNull String packageId) throws LicenceNotAcceptedException, InstallFailedException Description copied from interface:SdkLoaderInstalls an Android Sdk Tool if it's not already installed.- Specified by:
installSdkToolin interfaceSdkLoader- 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 public com.google.common.collect.ImmutableList<String> retrieveRepoIdsWithPrefix(@NonNull SdkLibData sdkLibData, @NonNull String prefix) Description copied from interface:SdkLoaderRetrieves the hash ids for available remote repositories that start with the given prefix.- Specified by:
retrieveRepoIdsWithPrefixin interfaceSdkLoader- 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
Description copied from interface:SdkLoaderRetrieves 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.
- Specified by:
getLocalEmulatorin interfaceSdkLoader- Returns:
- The location of the emulator, or null if it is not installed.
-