com.android.sdklib
Interface IAndroidTarget

All Superinterfaces:
java.lang.Comparable<IAndroidTarget>

public interface IAndroidTarget
extends java.lang.Comparable<IAndroidTarget>

A version of Android that applications can target when building.


Nested Class Summary
static interface IAndroidTarget.OptionalLibrary
          An optional library provided by an Android Target
 
Field Summary
static int ACTIONS_ACTIVITY
          OS Path to the "data/activity_actions.txt" file.
static int ACTIONS_BROADCAST
          OS Path to the "data/broadcast_actions.txt" file.
static int ACTIONS_SERVICE
          OS Path to the "data/service_actions.txt" file.
static int ANDROID_AIDL
          OS Path to the "framework.aidl" file.
static int ANDROID_JAR
          OS Path to the "android.jar" file.
static int ANT
          OS Path to the "ant" folder which contains the ant build rules (ver 2 and above)
static int ATTRIBUTES
          OS Path to the "attrs.xml" file.
static int CATEGORIES
          OS Path to the "data/categories.txt" file.
static int DATA
          OS Path to the "data" folder which contains data & libraries for the SDK tools.
static int DOCS
          OS Path to the target specific docs
static int FONTS
          OS Path to the "data/fonts" folder.
static int LAYOUT_LIB
          OS Path to the "data/layoutlib.jar" library.
static int MANIFEST_ATTRIBUTES
          OS Path to the "attrs_manifest.xml" file.
static int NO_USB_ID
          Return value for getUsbVendorId() meaning no USB vendor IDs are defined by the Android target.
static int RESOURCES
          OS Path to the "data/res" folder.
static int SAMPLES
          OS Path to the "samples" folder which contains sample projects.
static int SKINS
          OS Path to the "skins" folder which contains the emulator skins.
static int SOURCES
          OS Path to the "sources" folder.
static int TEMPLATES
          OS Path to the "templates" folder which contains the templates for new projects.
static int UI_AUTOMATOR_JAR
          OS Path to the "uiautomator.jar" file.
static int WIDGETS
          OS Path to the "data/widgets.txt" file.
 
Method Summary
 boolean canRunOn(IAndroidTarget target)
          Returns whether the given target is compatible with the receiver.
 java.util.List<IAndroidTarget.OptionalLibrary> getAdditionalLibraries()
          Returns the additional libraries for this target.
 java.util.List<java.lang.String> getBootClasspath()
          Returns the boot classpath for this target.
 BuildToolInfo getBuildToolInfo()
          Returns a BuildToolInfo for backward compatibility.
 java.lang.String getClasspathName()
          Returns the name to be displayed when representing all the libraries this target contains.
 java.io.File getDefaultSkin()
          Returns the default skin folder for this target.
 java.lang.String getDescription()
          Returns the description of the target.
 java.io.File getFile(int pathId)
          Returns the path of a platform component.
 java.lang.String getFullName()
          Returns the full name of the target, possibly including vendor name.
 java.lang.String getLocation()
          Returns the target location.
 java.lang.String getName()
          Returns the name of the target.
 java.util.List<IAndroidTarget.OptionalLibrary> getOptionalLibraries()
          Returns a list of optional libraries for this target.
 IAndroidTarget getParent()
          Returns the parent target.
 java.lang.String getPath(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.String getProperty(java.lang.String name)
          Return the value of a given property for this target.
 java.lang.Boolean getProperty(java.lang.String name, java.lang.Boolean defaultValue)
          Returns the value of a given property for this target as a Boolean value.
 java.lang.Integer getProperty(java.lang.String name, java.lang.Integer defaultValue)
          Returns the value of a given property for this target as an Integer value.
 int getRevision()
          Returns the revision number for the target.
 java.lang.String getShortClasspathName()
          Returns the name to be displayed when representing all the libraries this target contains.
 java.io.File[] getSkins()
          Returns the available skin folders for this target.
 ISystemImage getSystemImage(IdDisplay tag, java.lang.String abiType)
          Returns the system image information for the given tag and abiType.
 ISystemImage[] getSystemImages()
          Returns an array of system images for this target.
 int getUsbVendorId()
          Returns the USB Vendor ID for the vendor of this target.
 java.lang.String getVendor()
          Returns the name of the vendor of the target.
 AndroidVersion getVersion()
          Returns the version of the target.
 java.lang.String getVersionName()
          Returns the platform version as a readable string.
 java.lang.String hashString()
          Returns a string able to uniquely identify a target.
 boolean hasRenderingLibrary()
          Returns whether the target is able to render layouts.
 boolean isPlatform()
          Returns true if the target is a standard Android platform.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

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 & 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
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

NO_USB_ID

static final int NO_USB_ID
Return value for getUsbVendorId() meaning no USB vendor IDs are defined by the Android target.

See Also:
Constant Field Values
Method Detail

getLocation

java.lang.String getLocation()
Returns the target location.


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.


getDescription

java.lang.String getDescription()
Returns the description of the target.


getVersion

@NonNull
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

IAndroidTarget getParent()
Returns the parent target. This is likely to only be non null if isPlatform() returns false


getPath

java.lang.String 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 the IAndroidTarget interface can be used.

getFile

java.io.File getFile(int pathId)
Returns the path of a platform component.

This is like the legacy getPath(int) method except it returns a File.

Parameters:
pathId - the id representing the path to return. Any of the constants defined in the IAndroidTarget interface can be used.

getBuildToolInfo

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 calling getPath(int) with ANDROID_JAR.

Returns:
a non null list of the boot classpath.

getOptionalLibraries

@NonNull
java.util.List<IAndroidTarget.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-library entry in the manifest.

Returns:
a list of libraries.
See Also:
IAndroidTarget.OptionalLibrary.getName()

getAdditionalLibraries

@NonNull
java.util.List<IAndroidTarget.OptionalLibrary> getAdditionalLibraries()
Returns the additional libraries for this target. These libraries are automatically added to the classpath, but using them requires adding a uses-library entry in the manifest.

Returns:
a list of libraries.
See Also:
IAndroidTarget.OptionalLibrary.getName()

hasRenderingLibrary

boolean hasRenderingLibrary()
Returns whether the target is able to render layouts.


getSkins

@NonNull
java.io.File[] getSkins()
Returns the available skin folders for this target.

To get the skin names, use File.getName().
Skins come either from:

The array can be empty but not null.


getDefaultSkin

@Nullable
java.io.File 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 null if 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 null if it was not found.

getProperty

java.lang.Integer getProperty(java.lang.String name,
                              java.lang.Integer defaultValue)
Returns the value of a given property for this target as an Integer value.

If the value is missing or is not an integer, the method will return the given default value.

Parameters:
name - the name of the property to return
defaultValue - the default value to return.
See Also:
Integer.decode(String)

getProperty

java.lang.Boolean getProperty(java.lang.String name,
                              java.lang.Boolean defaultValue)
Returns the value of a given property for this target as a Boolean value.

If the value is missing or is not an boolean, the method will return the given default value.

Parameters:
name - the name of the property to return
defaultValue - the default value to return.
See Also:
Boolean.valueOf(String)

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.


getUsbVendorId

int getUsbVendorId()
Returns the USB Vendor ID for the vendor of this target.

If the target defines no USB Vendor ID, then the method return 0.


getSystemImages

ISystemImage[] getSystemImages()
Returns an array of system images for this target. The array can be empty but not null.


getSystemImage

@Nullable
ISystemImage getSystemImage(@NonNull
                                     IdDisplay tag,
                                     @NonNull
                                     java.lang.String abiType)
Returns the system image information for the given tag and abiType.

Parameters:
tag - A tag id-display.
abiType - An ABI type string.
Returns:
An existing ISystemImage for the requested abiType or null if none exists for this type.

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 AndroidTargetHash for helper methods to manipulate hash strings.