Android Plugin DSL Reference

Version 3.4.0-dev

Introduction

This is the DSL reference for Android Gradle Plugin.

Start reading by finding the right extension type for the plugin you are using, e.g. AppExtension.

Extension types

Listed below are the Gradle extension types used by respective plugins:

TypeDescription
AppExtension

The android extension for application plugins.

LibraryExtension

The android extension for com.android.library projects.

TestExtension

android extension for com.android.test projects.

FeatureExtension

The android extension for com.android.feature projects.

Configuration blocks

Listed below are the configuration blocks available within android

BlockDescription
aaptOptions { }

Specifies options for the Android Asset Packaging Tool (AAPT).

adbOptions { }

Specifies options for the Android Debug Bridge (ADB), such as APK installation options.

buildTypes { }

Encapsulates all build type configurations for this project.

compileOptions { }

Specifies Java compiler options, such as the language level of the Java source code and generated bytecode.

dataBinding { }

Specifies options for the Data Binding Library.

defaultConfig { }

Specifies defaults for variant properties that the Android plugin applies to all build variants.

dexOptions { }

Specifies options for the DEX tool, such as enabling library pre-dexing.

externalNativeBuild { }

Configures external native build using CMake or ndk-build.

jacoco { }

Configure JaCoCo version that is used for offline instrumentation and coverage report.

lintOptions { }

Specifies options for the lint tool.

packagingOptions { }

Specifies options and rules that determine which files the Android plugin packages into your APK.

productFlavors { }

Encapsulates all product flavors configurations for this project.

signingConfigs { }

Encapsulates signing configurations that you can apply to BuildType and ProductFlavor configurations.

sourceSets { }

Encapsulates source set configurations for all variants.

splits { }

Specifies configurations for building multiple APKs or APK splits.

testOptions { }

Specifies options for how the Android plugin should run local and instrumented tests.