[go: up one dir, main page]

BaseExtension

Base 'android' extension for all android plugins.

This is never used directly. Instead,

Properties

PropertyDescription
aaptOptions

Options for aapt, tool for packaging resources.

adbOptions

Adb options

buildToolsVersion

Required. Version of the build tools to use.

buildTypes

Build types used by this project.

compileOptions

Compile options

compileSdkVersion

Required. Compile SDK version.

defaultConfig

Default config, shared by all flavors.

defaultPublishConfig

Name of the configuration used to build the default artifact of this project.

dexOptions

Dex options.

flavorDimensionList

The names of flavor dimensions.

generatePureSplits

Whether to generate pure splits or multi apk

jacoco

JaCoCo options.

lintOptions

Lint options.

ndkDirectory

The NDK directory used.

packagingOptions

Packaging options.

productFlavors

All product flavors used by this project.

publishNonDefault

Whether to publish artifacts for all configurations, not just the default one.

resourcePrefix

A prefix to be used when creating new resources. Used by Studio

sdkDirectory

The SDK directory used.

signingConfigs

Signing configs used by this project.

sourceSets

All source sets. Note that the Android plugin uses its own implementation of source sets, AndroidSourceSet.

splits

APK splits

testOptions

Options for running tests.

variantFilter

Callback to control which variants should be excluded.

Methods

MethodDescription
flavorDimensions(dimensions)

Specifies names of flavor dimensions.

useLibrary(name)

Request the use a of Library. The library is then added to the classpath.

useLibrary(name, required)

Request the use a of Library. The library is then added to the classpath.

Script blocks

BlockDescription
aaptOptions

Configures aapt options.

adbOptions

Configures adb options.

buildTypes

Configures build types.

compileOptions

Configures compile options.

defaultConfig

The default configuration, inherited by all product flavors (if any are defined).

dexOptions

Configures dex options.

jacoco

Configures JaCoCo options.

lintOptions

Configures lint options.

packagingOptions

Configures packaging options.

productFlavors

Configures product flavors.

signingConfigs

Configures signing configs.

sourceSets

Configures source sets.

splits

Configures APK splits.

testOptions

Configures test options.

Property details

AaptOptions aaptOptions

Options for aapt, tool for packaging resources.

AdbOptions adbOptions

Adb options

String buildToolsVersion

Required. Version of the build tools to use.

Value assigned to this property is parsed and stored in a normalized form, so reading it back may give a slightly different string.

Collection<BuildType> buildTypes

Build types used by this project.

CompileOptions compileOptions

Compile options

String compileSdkVersion

Required. Compile SDK version.

Your code will be compiled against the android.jar from this API level. You should generally use the most up-to-date SDK version here. Use the Lint tool to make sure you don't use APIs not available in earlier platform version without checking.

Setter can be called with a string like "android-21" or a number.

Value assigned to this property is parsed and stored in a normalized form, so reading it back may give a slightly different string.

ProductFlavor defaultConfig

Default config, shared by all flavors.

String defaultPublishConfig

Name of the configuration used to build the default artifact of this project.

See Referencing a Library

DexOptions dexOptions

Dex options.

List<String> flavorDimensionList

The names of flavor dimensions.

See Multi-flavor variants.

boolean generatePureSplits

Whether to generate pure splits or multi apk

JaCoCo options.

LintOptions lintOptions

Lint options.

File ndkDirectory

The NDK directory used.

PackagingOptions packagingOptions

Packaging options.

Collection<ProductFlavor> productFlavors

All product flavors used by this project.

boolean publishNonDefault

Whether to publish artifacts for all configurations, not just the default one.

See Referencing a Library

String resourcePrefix

A prefix to be used when creating new resources. Used by Studio

File sdkDirectory

The SDK directory used.

Collection<SigningConfig> signingConfigs

Signing configs used by this project.

All source sets. Note that the Android plugin uses its own implementation of source sets, AndroidSourceSet.

Splits splits

APK splits

TestOptions testOptions

Options for running tests.

Action<VariantFilter> variantFilter

Callback to control which variants should be excluded.

The Action is passed a single object of type VariantFilter. It should set the VariantFilter.setIgnore() flag to filter out the given variant.

Method details

void flavorDimensions(String... dimensions)

Specifies names of flavor dimensions.

See Multi-flavor variants.

void useLibrary(String name)

Request the use a of Library. The library is then added to the classpath.

void useLibrary(String name, boolean required)

Request the use a of Library. The library is then added to the classpath.

Script block details

aaptOptions { }

Configures aapt options.

Delegates to:
AaptOptions from aaptOptions

adbOptions { }

Configures adb options.

Delegates to:
AdbOptions from adbOptions

buildTypes { }

Configures build types.

Delegates to:
Each BuildType in buildTypes

compileOptions { }

Configures compile options.

Delegates to:
CompileOptions from compileOptions

defaultConfig { }

The default configuration, inherited by all product flavors (if any are defined).

Delegates to:
ProductFlavor from defaultConfig

dexOptions { }

Configures dex options.

Delegates to:
DexOptions from dexOptions

jacoco { }

Configures JaCoCo options.

Delegates to:
JacocoOptions from jacoco

lintOptions { }

Configures lint options.

Delegates to:
LintOptions from lintOptions

packagingOptions { }

Configures packaging options.

productFlavors { }

Configures product flavors.

Delegates to:
Each ProductFlavor in productFlavors

signingConfigs { }

Configures signing configs.

Delegates to:
Each SigningConfig in signingConfigs

sourceSets { }

Configures source sets.

Note that the Android plugin uses its own implementation of source sets, AndroidSourceSet.

splits { }

Configures APK splits.

Delegates to:
Splits from splits

testOptions { }

Configures test options.

Delegates to:
TestOptions from testOptions