public class SdkManager
extends java.lang.Object
PlatformTarget,
AddOnTarget| Modifier and Type | Class and Description |
|---|---|
static class |
SdkManager.LayoutlibVersion |
| Modifier | Constructor and Description |
|---|---|
protected |
SdkManager(java.lang.String osSdkPath)
Create a new
SdkManager instance. |
| Modifier and Type | Method and Description |
|---|---|
static SdkManager |
createManager(java.lang.String osSdkPath,
com.android.utils.ILogger log)
Creates an
SdkManager for a given sdk location. |
BuildToolInfo |
getBuildTool(FullRevision revision)
Returns the
BuildToolInfo for the given revision. |
java.util.Set<FullRevision> |
getBuildTools()
Deprecated.
|
java.util.Map<java.io.File,java.lang.String> |
getExtraSamples()
Returns a map of the root samples directories located in the SDK/extras packages.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getExtrasVersions()
Deprecated.
Starting with add-on schema 6, extras can have full revisions instead of just
major revisions. This API only returns the major revision. Callers should be modified
to use the new {code LocalSdk.getPkgInfo(LocalSdk.PKG_EXTRAS)} API instead.
|
BuildToolInfo |
getLatestBuildTool()
Returns the highest build-tool revision known.
|
LocalSdk |
getLocalSdk() |
java.lang.String |
getLocation()
Returns the location of the SDK.
|
SdkManager.LayoutlibVersion |
getMaxLayoutlibVersion()
Deprecated.
This does NOT solve the right problem and will be changed later.
|
java.lang.String |
getPlatformToolsVersion()
Returns the platform tools version if installed, null otherwise.
|
IAndroidTarget |
getTargetFromHashString(java.lang.String hash)
Returns a target from a hash that was generated by
IAndroidTarget.hashString(). |
IAndroidTarget[] |
getTargets()
Returns the targets (platforms & addons) that are available in the SDK.
|
boolean |
hasChanged()
Checks whether any of the SDK platforms/add-ons/build-tools have changed on-disk
since we last loaded the SDK.
|
boolean |
hasChanged(com.android.utils.ILogger log)
Checks whether any of the SDK platforms/add-ons/build-tools have changed on-disk
since we last loaded the SDK.
|
void |
reloadSdk(com.android.utils.ILogger log)
Reloads the content of the SDK.
|
void |
updateAdb()
Updates adb with the USB devices declared in the SDK add-ons.
|
protected SdkManager(@NonNull
java.lang.String osSdkPath)
SdkManager instance.
External users should use createManager(String, ILogger).osSdkPath - the location of the SDK.@Nullable public static SdkManager createManager(@NonNull java.lang.String osSdkPath, @NonNull com.android.utils.ILogger log)
SdkManager for a given sdk location.osSdkPath - the location of the SDK.log - the ILogger object receiving warning/error from the parsing.SdkManager or null if the location is not valid.@NonNull public LocalSdk getLocalSdk()
public void reloadSdk(@NonNull
com.android.utils.ILogger log)
log - the ILogger object receiving warning/error from the parsing.public boolean hasChanged()
public boolean hasChanged(@Nullable
com.android.utils.ILogger log)
log - An optional logger used to print verbose info on what changed. Can be null.@NonNull public java.lang.String getLocation()
@NonNull public IAndroidTarget[] getTargets()
reloadSdk(ILogger) is called.
The array can be empty but not null.@Deprecated @NonNull public java.util.Set<FullRevision> getBuildTools()
@Nullable public BuildToolInfo getLatestBuildTool()
@Nullable public BuildToolInfo getBuildTool(@Nullable FullRevision revision)
BuildToolInfo for the given revision.revision - The requested revision.BuildToolInfo. Can be null if revision is null or is
not part of the known set returned by getBuildTools().@Nullable public IAndroidTarget getTargetFromHashString(@Nullable java.lang.String hash)
IAndroidTarget.hashString().hash - the IAndroidTarget hash string.IAndroidTarget or null.public void updateAdb()
throws com.android.prefs.AndroidLocation.AndroidLocationException,
java.io.IOException
com.android.prefs.AndroidLocation.AndroidLocationExceptionjava.io.IOException@Deprecated @Nullable public SdkManager.LayoutlibVersion getMaxLayoutlibVersion()
SdkManager.LayoutlibVersion found amongst all platform
targets currently loaded in the SDK.
We only started recording Layoutlib Versions recently in the platform meta data
so it's possible to have an SDK with many platforms loaded but no layoutlib
version defined.SdkManager.LayoutlibVersion or null if none is found.@NonNull public java.util.Map<java.io.File,java.lang.String> getExtraSamples()
@Deprecated @NonNull public java.util.Map<java.lang.String,java.lang.Integer> getExtrasVersions()
@Nullable public java.lang.String getPlatformToolsVersion()