Class AddonTarget
- java.lang.Object
-
- com.android.sdklib.repository.targets.AddonTarget
-
- All Implemented Interfaces:
IAndroidTarget,java.lang.Comparable<IAndroidTarget>
public class AddonTarget extends java.lang.Object implements IAndroidTarget
Represents an add-on target in the SDK. An add-on extends a standardPlatformTarget.
-
-
Field Summary
-
Fields inherited from interface com.android.sdklib.IAndroidTarget
ACTIONS_ACTIVITY, ACTIONS_BROADCAST, ACTIONS_SERVICE, ANDROID_AIDL, ANDROID_JAR, ANT, ATTRIBUTES, CATEGORIES, CORE_FOR_SYSTEM_MODULES_JAR, DATA, DOCS, FONTS, LAYOUT_LIB, MANIFEST_ATTRIBUTES, RESOURCES, SAMPLES, SKINS, SOURCES, TEMPLATES, UI_AUTOMATOR_JAR, WIDGETS
-
-
Constructor Summary
Constructors Constructor Description AddonTarget(com.android.repository.api.LocalPackage p, IAndroidTarget baseTarget, com.android.repository.api.ProgressIndicator progress)Constructs a newAddonTarget.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanRunOn(IAndroidTarget target)Returns whether the given target is compatible with the receiver.intcompareTo(IAndroidTarget target)booleanequals(java.lang.Object obj)java.util.List<OptionalLibrary>getAdditionalLibraries()Returns the additional libraries for this target.java.util.List<java.lang.String>getBootClasspath()Returns the boot classpath for this target.BuildToolInfogetBuildToolInfo()Returns a BuildToolInfo for backward compatibility.java.lang.StringgetClasspathName()Returns the name to be displayed when representing all the libraries this target contains.java.nio.file.PathgetDefaultSkin()Returns the default skin folder for this target.java.lang.StringgetFullName()Returns the full name of the target, possibly including vendor name.java.lang.StringgetLocation()Returns the target location, including a trailing file separator.java.lang.StringgetName()Returns the name of the target.java.util.List<OptionalLibrary>getOptionalLibraries()Returns a list of optional libraries for this target.IAndroidTargetgetParent()Returns the parent target.java.nio.file.PathgetPath(int pathId)Returns the path of a platform component.java.lang.String[]getPlatformLibraries()Returns the list of libraries available for a given platform.java.util.Map<java.lang.String,java.lang.String>getProperties()Returns all the properties associated with this target.java.lang.StringgetProperty(java.lang.String name)Return the value of a given property for this target.intgetRevision()Returns the revision number for the target.java.lang.StringgetShortClasspathName()Returns the name to be displayed when representing all the libraries this target contains.java.nio.file.Path[]getSkins()Returns the available skin folders for this target.java.lang.StringgetVendor()Returns the name of the vendor of the target.com.android.sdklib.AndroidVersiongetVersion()Returns the version of the target.java.lang.StringgetVersionName()Returns the platform version as a readable string.inthashCode()java.lang.StringhashString()Returns a string able to uniquely identify a target.booleanhasRenderingLibrary()Returns whether the target is able to render layouts.booleanisPlatform()Returns true if the target is a standard Android platform.
-
-
-
Constructor Detail
-
AddonTarget
public AddonTarget(@NonNull com.android.repository.api.LocalPackage p, @NonNull IAndroidTarget baseTarget, @NonNull com.android.repository.api.ProgressIndicator progress)Constructs a newAddonTarget.- Parameters:
p- TheLocalPackagecontaining this target.baseTarget- TheIAndroidTargeton which this addon is based.
-
-
Method Detail
-
getLocation
@NonNull public java.lang.String getLocation()
Description copied from interface:IAndroidTargetReturns the target location, including a trailing file separator.- Specified by:
getLocationin interfaceIAndroidTarget
-
getVendor
public java.lang.String getVendor()
Description copied from interface:IAndroidTargetReturns the name of the vendor of the target.- Specified by:
getVendorin interfaceIAndroidTarget
-
getName
public java.lang.String getName()
Description copied from interface:IAndroidTargetReturns the name of the target.- Specified by:
getNamein interfaceIAndroidTarget
-
getFullName
public java.lang.String getFullName()
Description copied from interface:IAndroidTargetReturns the full name of the target, possibly including vendor name.- Specified by:
getFullNamein interfaceIAndroidTarget
-
getClasspathName
public java.lang.String getClasspathName()
Description copied from interface:IAndroidTargetReturns the name to be displayed when representing all the libraries this target contains.- Specified by:
getClasspathNamein interfaceIAndroidTarget
-
getShortClasspathName
public java.lang.String getShortClasspathName()
Description copied from interface:IAndroidTargetReturns the name to be displayed when representing all the libraries this target contains.- Specified by:
getShortClasspathNamein interfaceIAndroidTarget
-
getVersion
@NonNull public com.android.sdklib.AndroidVersion getVersion()
Description copied from interface:IAndroidTargetReturns the version of the target. This is guaranteed to be non-null.- Specified by:
getVersionin interfaceIAndroidTarget
-
getVersionName
public java.lang.String getVersionName()
Description copied from interface:IAndroidTargetReturns the platform version as a readable string.- Specified by:
getVersionNamein interfaceIAndroidTarget
-
getRevision
public int getRevision()
Description copied from interface:IAndroidTargetReturns the revision number for the target.- Specified by:
getRevisionin interfaceIAndroidTarget
-
isPlatform
public boolean isPlatform()
Description copied from interface:IAndroidTargetReturns true if the target is a standard Android platform.- Specified by:
isPlatformin interfaceIAndroidTarget
-
getParent
public IAndroidTarget getParent()
Description copied from interface:IAndroidTargetReturns the parent target. This is likely to only be nonnullifIAndroidTarget.isPlatform()returnsfalse- Specified by:
getParentin interfaceIAndroidTarget
-
getPath
@NonNull public java.nio.file.Path getPath(int pathId)
Description copied from interface:IAndroidTargetReturns the path of a platform component.- Specified by:
getPathin interfaceIAndroidTarget- Parameters:
pathId- the id representing the path to return. Any of the constants defined in theIAndroidTargetinterface can be used.
-
getBuildToolInfo
public BuildToolInfo getBuildToolInfo()
Description copied from interface:IAndroidTargetReturns a BuildToolInfo for backward compatibility. If an older SDK is used this will return paths located in the platform-tools, otherwise it'll return paths located in the latest build-tools.- Specified by:
getBuildToolInfoin interfaceIAndroidTarget- Returns:
- a BuildToolInfo or null if none are available.
-
getBootClasspath
@NonNull public java.util.List<java.lang.String> getBootClasspath()
Description copied from interface:IAndroidTargetReturns the boot classpath for this target. In most case, this is similar to callingIAndroidTarget.getPath(int)withIAndroidTarget.ANDROID_JAR.- Specified by:
getBootClasspathin interfaceIAndroidTarget- Returns:
- a non null list of the boot classpath.
-
getOptionalLibraries
@NonNull public java.util.List<OptionalLibrary> getOptionalLibraries()
Description copied from interface:IAndroidTargetReturns a list of optional libraries for this target.These libraries are not automatically added to the classpath. Using them requires adding a
uses-libraryentry in the manifest and callinguseLibraryin the Gradle build script. Example of such library isorg.apache.http.legacywhich is not on the classpath by default since 6.0.- Specified by:
getOptionalLibrariesin interfaceIAndroidTarget- Returns:
- a list of libraries.
- See Also:
OptionalLibrary.getName()
-
getAdditionalLibraries
@NonNull public java.util.List<OptionalLibrary> getAdditionalLibraries()
Description copied from interface:IAndroidTargetReturns the additional libraries for this target.These libraries are automatically added to the classpath, but using them requires adding a
uses-libraryentry in the manifest. Example of such library iscom.google.android.maps, which is part of the Google APIs add-on.- Specified by:
getAdditionalLibrariesin interfaceIAndroidTarget- Returns:
- a list of libraries.
- See Also:
OptionalLibrary.getName()
-
hasRenderingLibrary
public boolean hasRenderingLibrary()
Description copied from interface:IAndroidTargetReturns whether the target is able to render layouts.- Specified by:
hasRenderingLibraryin interfaceIAndroidTarget
-
getSkins
@NonNull public java.nio.file.Path[] getSkins()
Description copied from interface:IAndroidTargetReturns the available skin folders for this target.To get the skin names, use
File.getName().
Skins come either from:- a platform (
sdk/platforms/N/skins/name) - an add-on (
sdk/addons/name/skins/name) - a tagged system-image (
sdk/system-images/platform-N/tag/abi/skins/name.)
- Specified by:
getSkinsin interfaceIAndroidTarget
- a platform (
-
getDefaultSkin
@Nullable public java.nio.file.Path getDefaultSkin()
Description copied from interface:IAndroidTargetReturns the default skin folder for this target.To get the skin name, use
File.getName().- Specified by:
getDefaultSkinin interfaceIAndroidTarget
-
getPlatformLibraries
public java.lang.String[] getPlatformLibraries()
Description copied from interface:IAndroidTargetReturns the list of libraries available for a given platform.- Specified by:
getPlatformLibrariesin interfaceIAndroidTarget- Returns:
- an array of libraries provided by the platform or
nullif there is none.
-
getProperty
public java.lang.String getProperty(java.lang.String name)
Description copied from interface:IAndroidTargetReturn the value of a given property for this target.- Specified by:
getPropertyin interfaceIAndroidTarget- Returns:
- the property value or
nullif it was not found.
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties()
Description copied from interface:IAndroidTargetReturns all the properties associated with this target. This can be null if the target has no properties.- Specified by:
getPropertiesin interfaceIAndroidTarget
-
canRunOn
public boolean canRunOn(IAndroidTarget target)
Description copied from interface:IAndroidTargetReturns whether the given target is compatible with the receiver.This means that a project using the receiver's target can run on the given target.
Example:CupcakeTarget.canRunOn(DonutTarget) == true
.- Specified by:
canRunOnin interfaceIAndroidTarget- Parameters:
target- the IAndroidTarget to test.
-
hashString
public java.lang.String hashString()
Description copied from interface:IAndroidTargetReturns a string able to uniquely identify a target. Typically the target will encode information such as api level, whether it's a platform or add-on, and if it's an add-on vendor and add-on name.See
AndroidTargetHashfor helper methods to manipulate hash strings.- Specified by:
hashStringin interfaceIAndroidTarget
-
compareTo
public int compareTo(@NonNull IAndroidTarget target)- Specified by:
compareToin interfacejava.lang.Comparable<IAndroidTarget>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-