Interface IAndroidTarget
-
- All Superinterfaces:
java.lang.Comparable<IAndroidTarget>
- All Known Implementing Classes:
AddonTarget,PlatformTarget
public interface IAndroidTarget extends java.lang.Comparable<IAndroidTarget>
A version of Android that applications can target when building.
-
-
Field Summary
Fields Modifier and Type Field Description static intACTIONS_ACTIVITYOS path to the "data/activity_actions.txt" file.static intACTIONS_BROADCASTOS path to the "data/broadcast_actions.txt" file.static intACTIONS_SERVICEOS path to the "data/service_actions.txt" file.static intANDROID_AIDLOS path to the "framework.aidl" file.static intANDROID_JAROS path to the "android.jar" file.static intANTOS path to the "ant" folder which contains the ant build rules (ver 2 and above)static intATTRIBUTESOS path to the "attrs.xml" file.static intCATEGORIESOS path to the "data/categories.txt" file.static intCORE_FOR_SYSTEM_MODULES_JAROS path to the "core-for-system-modules.jar" filestatic intDATAOS path to the "data" folder which contains data and libraries for the SDK tools.static intDOCSOS path to the target specific docsstatic intFONTSOS path to the "data/fonts" folder.static intLAYOUT_LIBOS path to the "data/layoutlib.jar" library.static intMANIFEST_ATTRIBUTESOS path to the "attrs_manifest.xml" file.static intRESOURCESFor render resources this is the OS path to framework_res.jar.static intSAMPLESOS path to the "samples" folder which contains sample projects.static intSKINSOS path to the "skins" folder which contains the emulator skins.static intSOURCESOS path to the "sources" folder.static intTEMPLATESOS path to the "templates" folder which contains the templates for new projects.static intUI_AUTOMATOR_JAROS path to the "uiautomator.jar" file.static intWIDGETSOS path to the "data/widgets.txt" file.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanRunOn(IAndroidTarget target)Returns whether the given target is compatible with the receiver.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.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.
-
-
-
Field Detail
-
ANDROID_JAR
static final int ANDROID_JAR
OS path to the "android.jar" file.- See Also:
- Constant Field Values
-
ANDROID_AIDL
static final int ANDROID_AIDL
OS path to the "framework.aidl" file.- See Also:
- Constant Field Values
-
SAMPLES
static final int SAMPLES
OS path to the "samples" folder which contains sample projects.- See Also:
- Constant Field Values
-
SKINS
static final int SKINS
OS path to the "skins" folder which contains the emulator skins.- See Also:
- Constant Field Values
-
TEMPLATES
static final int TEMPLATES
OS path to the "templates" folder which contains the templates for new projects.- See Also:
- Constant Field Values
-
DATA
static final int DATA
OS path to the "data" folder which contains data and libraries for the SDK tools.- See Also:
- Constant Field Values
-
ATTRIBUTES
static final int ATTRIBUTES
OS path to the "attrs.xml" file.- See Also:
- Constant Field Values
-
MANIFEST_ATTRIBUTES
static final int MANIFEST_ATTRIBUTES
OS path to the "attrs_manifest.xml" file.- See Also:
- Constant Field Values
-
LAYOUT_LIB
static final int LAYOUT_LIB
OS path to the "data/layoutlib.jar" library.- See Also:
- Constant Field Values
-
RESOURCES
static final int RESOURCES
For render resources this is the OS path to framework_res.jar. For other framework resources this is the OS path to the "data/res" folder.- See Also:
- Constant Field Values
-
FONTS
static final int FONTS
OS path to the "data/fonts" folder.- See Also:
- Constant Field Values
-
WIDGETS
static final int WIDGETS
OS path to the "data/widgets.txt" file.- See Also:
- Constant Field Values
-
ACTIONS_ACTIVITY
static final int ACTIONS_ACTIVITY
OS path to the "data/activity_actions.txt" file.- See Also:
- Constant Field Values
-
ACTIONS_BROADCAST
static final int ACTIONS_BROADCAST
OS path to the "data/broadcast_actions.txt" file.- See Also:
- Constant Field Values
-
ACTIONS_SERVICE
static final int ACTIONS_SERVICE
OS path to the "data/service_actions.txt" file.- See Also:
- Constant Field Values
-
CATEGORIES
static final int CATEGORIES
OS path to the "data/categories.txt" file.- See Also:
- Constant Field Values
-
SOURCES
static final int SOURCES
OS path to the "sources" folder.- See Also:
- Constant Field Values
-
DOCS
static final int DOCS
OS path to the target specific docs- See Also:
- Constant Field Values
-
ANT
static final int ANT
OS path to the "ant" folder which contains the ant build rules (ver 2 and above)- See Also:
- Constant Field Values
-
UI_AUTOMATOR_JAR
static final int UI_AUTOMATOR_JAR
OS path to the "uiautomator.jar" file.- See Also:
- Constant Field Values
-
CORE_FOR_SYSTEM_MODULES_JAR
static final int CORE_FOR_SYSTEM_MODULES_JAR
OS path to the "core-for-system-modules.jar" file- See Also:
- Constant Field Values
-
-
Method Detail
-
getLocation
@NonNull java.lang.String getLocation()
Returns the target location, including a trailing file separator.
-
getVendor
java.lang.String getVendor()
Returns the name of the vendor of the target.
-
getName
java.lang.String getName()
Returns the name of the target.
-
getFullName
java.lang.String getFullName()
Returns the full name of the target, possibly including vendor name.
-
getClasspathName
java.lang.String getClasspathName()
Returns the name to be displayed when representing all the libraries this target contains.
-
getShortClasspathName
java.lang.String getShortClasspathName()
Returns the name to be displayed when representing all the libraries this target contains.
-
getVersion
@NonNull com.android.sdklib.AndroidVersion getVersion()
Returns the version of the target. This is guaranteed to be non-null.
-
getVersionName
java.lang.String getVersionName()
Returns the platform version as a readable string.
-
getRevision
int getRevision()
Returns the revision number for the target.
-
isPlatform
boolean isPlatform()
Returns true if the target is a standard Android platform.
-
getParent
@Nullable IAndroidTarget getParent()
-
getPath
@NonNull java.nio.file.Path getPath(int pathId)
Returns the path of a platform component.- Parameters:
pathId- the id representing the path to return. Any of the constants defined in theIAndroidTargetinterface can be used.
-
getBuildToolInfo
@Nullable BuildToolInfo getBuildToolInfo()
Returns 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.- Returns:
- a BuildToolInfo or null if none are available.
-
getBootClasspath
@NonNull java.util.List<java.lang.String> getBootClasspath()
Returns the boot classpath for this target. In most case, this is similar to callinggetPath(int)withANDROID_JAR.- Returns:
- a non null list of the boot classpath.
-
getOptionalLibraries
@NonNull java.util.List<OptionalLibrary> getOptionalLibraries()
Returns 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.- Returns:
- a list of libraries.
- See Also:
OptionalLibrary.getName()
-
getAdditionalLibraries
@NonNull java.util.List<OptionalLibrary> getAdditionalLibraries()
Returns 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.- Returns:
- a list of libraries.
- See Also:
OptionalLibrary.getName()
-
hasRenderingLibrary
boolean hasRenderingLibrary()
Returns whether the target is able to render layouts.
-
getSkins
@NonNull java.nio.file.Path[] getSkins()
Returns 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.)
- a platform (
-
getDefaultSkin
@Nullable java.nio.file.Path getDefaultSkin()
Returns the default skin folder for this target.To get the skin name, use
File.getName().
-
getPlatformLibraries
java.lang.String[] getPlatformLibraries()
Returns the list of libraries available for a given platform.- Returns:
- an array of libraries provided by the platform or
nullif there is none.
-
getProperty
java.lang.String getProperty(java.lang.String name)
Return the value of a given property for this target.- Returns:
- the property value or
nullif it was not found.
-
getProperties
java.util.Map<java.lang.String,java.lang.String> getProperties()
Returns all the properties associated with this target. This can be null if the target has no properties.
-
canRunOn
boolean canRunOn(IAndroidTarget target)
Returns 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
.- Parameters:
target- the IAndroidTarget to test.
-
hashString
java.lang.String hashString()
Returns 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.
-
-