Android Plugin DSL Reference

Version 1.1.2

Introduction

This is the DSL reference for Android Gradle Plugin.

Android configuration structure

BlockDescription
aaptOptions { }

Configures aapt options.

buildTypes { }

Configures the build types.

compileOptions { }

Configures compile options.

defaultConfig { }

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

dexOptions { }

Configures dex options.

jacoco { }

Configures JaCoCo options.

lintOptions { }

Configure lint options.

packagingOptions { }

Configures packaging options.

productFlavors { }

Configures the product flavors.

signingConfigs { }

Configures the signing configs.

sourceSets { }

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

splits { }

Configures APK splits.

testOptions { }

Configures the test options.

DSL types

Listed below are some of the central types which are used in the Android plugin:

TypeDescription
AaptOptions

DSL object for configuring aapt options.

AndroidSourceSet

An AndroidSourceSet represents a logical group of Java, aidl and RenderScript sources as well as Android and non-Android (Java-style) resources.

AndroidSourceDirectorySet

An AndroidSourceDirectorySet represents a lit of directory input for an Android project.

AndroidSourceFile

An AndroidSourceFile represents a single file input for an Android project.

AppExtension

Options for com.android.application projects.

BaseExtension

Base 'android' extension for all android plugins.

BuildType

DSL object to configure build types.

CompileOptions

Compilation options.

DexOptions

DSL object for configuring dx options.

GroupableProductFlavor

A version of ProductFlavor that can receive a dimension name.

JacocoExtension

DSL object for configuring JaCoCo settings.

LibraryExtension

Options for com.android.library projects.

LintOptions

DSL object for configuring lint options.

PackagingOptions

DSL objects for configuring APK packaging options.

ProductFlavor

DSL object used to configure product flavors.

SigningConfig

DSL object for configuring signing configs.

Splits

DSL object for configuring APK Splits options.

TestOptions

Options for running tests.

VariantFilter

Exposes a read-only view of a variant as well as a flag that can be used to signal that the variant should be ignored.