Technical docs‎ > ‎

New Build System

This doc is deprecated. Redirecting to

We are working on a new build system to replace both the build system inside ADT and Ant.
Release notes:

  • The user cache for dex files is now enabled by default, which should speed up builds
  • Configuration times for very large projects should be significantly faster
  • For Instant Run, the "startup delay" (where large apps stall for a few seconds at startup) should be gone
  • Instant Run is using "APK Splits" when targeting Android N which is a bit more reliable than the classloader tricks it uses to target older platforms
2.2.0 (2016/9/19)
  • Manifest Merger : do not merge same dependencies multiple times.
  • New packager bug fixes :
    • ZFile: don't fail when data descriptor doesn't match CDH
    • Extract gzipped assets in the asset merger.
  • InstantRun, fixed case when changed manifest is not detected.

2.2.0-beta2 (2016/8/19)
2.2.0-beta1 (2016/8/8)
  • Upgrade required Gradle to 2.14.1
  • Fixes to reduce memory consumption during a Gradle Sync.
  • More Jack integration features, incremental mode.
  • InstantRun fixes related to IDE showing "No code changes"
2.2.0-alpha4 (2016/6/23)
  • Fixed instant-run regressions introduced in previous alpha builds related to code refactoring.
  • Turned off new packager by default due to some signing issues.
  • versionNameSuffix can now be specified for product flavors.
  • DexOptions now has an additionalParameters property for specifying custom flags for dx.
  • ProGuard files returned by getDefaultProguardFile are distributed with the plugin now, the ones in $ANDROID_HOME are no longer used.
  • SDK auto-download: Gradle will attempt to download missing SDK packages that a project depends on.
  • Added support for annotation processors. By default, annotation processors on your classpath, such as any compile dependency, will be automatically applied. You can also specify an annotation processor in your build and pass arguments by using the following DSL in your module-level build.gradle file:
    android {

   defaultConfig {

       javaCompileOptions {

           annotationProcessorOptions {

               className 'com.example.MyProcessor'

// Arguments are optional.

               arguments = [ foo : 'bar' ]





2.1.0 (2016/4/26) 
  • Fixed instant-run issue related to added dependencies and having other changes dropped.
2.1.0-rc1 (2016/4/22)
  • Turned on incremental Java compilation by default.

  • Turned on in process dexing by default if gradle daemon has enough memory allocated.

2.0.0-rc2/rc3 (2016/4/4) 
  • Fix for

  • Instant Run

    • Changed default slave count for dexing to 4

2.0.0-rc1 (2016/3/30) 
  • Instant Run

    • Dex each dependency independently rather than combining them in a single dependencies.jar

2.0.0-beta7/2.1.0-alpha3 (2016/3/19) 
  • N Preview (2.1.0-alpha3 only)

    • Support for JDK8 using Jack on Windows.

  • Instant Run

    • Changed slices allocation to be more deterministic (based on package name).

    • Fix for bug 202502 : Only top level activities can be restarted.

    • Automatically turnon pre-dexing 

    • Turn on Jumbo mode automatically in instant-run mode.

    • Changed slices allocation to be more deterministic (based on package name).

  • New Shrinker
    • Support For Atomic*FieldUpdater
2.1.0-alpha1 (2016/2/16) 

  • Support for N.

2.0.0-beta5 (2016/2/16) 

  • Instant Run

    • Disabled incremental javac compilation by default as it was not reliably recompiling R classes when needed.

2.0.0-beta4 (2016/2/11) 

  • Instant Run

    • Second attempts at fixing performance regression when building applications with large dependencies.

    • Second unrelated fix for issue when application was restarted, coldswap would not use the latest code.

    • New shrinker will now keep Application class when used with InstantRun.

    • Always for re-dexing when doing a coldswap to ensure latest code changes are pushed.

    • Add InstantRun verifier logic for native libraries.

    • Add "Provided" dependencies to InstantRun transforms.

    • Added DSL flag to disable incremental java compilation : compileOptions {

      incremental=true | false
    • Fix Dalvik verifier error when calling super method with short or byte parameter types.

    • Added a maxDexProcess to control how many slave dx process can be spawned concurrently : dexOptions {

  • Disable incremental java compilation when retro-lambda is used.

2.0.0-beta3 (2016/2/10) : never released

2.0.0-beta2 (2016/2/5)

  • Instant Run

    • Fixed performance regression when building applications with large dependencies.

    • Fixed issue when application was restarted, coldswap would not use the latest code.

    • Fixed issue when InstantRun would not clean its state after a coldswap resulting in 'no code change" messages.

    • Disabled InstantRun with legacy multidex (<21).

  • Disable incremental java compilation when "android-apt" plugin is present.

2.0.0-beta1 (2016/2/4) : never released

2.0.0-alpha9 (2016/1/30)

  • Instant Run

    • Switched Lollipop and Marshmallow to use native multidex as split apk had installation errors with dex2oat.

  • Disable dexInProcess by default unless android {

    dexOptions {
    dexInProcess = true

2.0.0-alpha8 (2016/1/28)

  • Instant Run

    • Switch Lollipop and Marshmallow to use Split apks

    • Disable Coldswap on Dalvik

    • Fix for deleted classes that could generate a FileNotFoundException

2.0.0-alpha7 (2016/1/23)

  • Instant Run

    • Handle compilation issues : if the build failed during the Java Compilation phase, InstantRun was forgetting some artifacts already built like resources.

    • Added more logging to JarMerger to track some duplicate file exception.

    • Disable hotswap when new class is added.

  • Enabled dexInProcess by default

2.0.0-alpha6 (2016/1/15)

  • Instant Run

    • Fix alpha5 reported issues : - cannot build when importing play-services. - zip exception with wrong size entries on some platforms. - make sure we don't add the same artifacts to the built list leading to wrong deployment list.

  • New Shrinker

    • Fix alpha5 reported issues

    • Enable new shrinker with Instant Run.

2.0.0-alpha5 (2016/1/14)

  • Instant Run

    • Implemented cold start (when code change cannot be applied with hot swap) - on pre-lollipop releases with Dalvik, restart.dex are produces each time a cold start is necessary - on lollipop, leverage multi dexes to slice applications in multiple dexes and rebuild/redeliver minimum set of dexes necessary. - on marshmallow, leverage split APK to deliver multi dexes.

    • Cold start solution is therefore depending on the target platform you are deploying to, please be sure to clearly document the target platform when filing issues.

    • in process Dexing on by default.

    • Enhanced interactions with the IDE, should reduce a lot the number of rebuild.

  • Shrinker
    • Can be enabled by setting buildTypes.debug.useProguard false

    • Doesn't obfuscate, only removes unused code

    • It's supposed to be faster, for iterative development but cannot be used while InstantRun is active yet.

  • Resource Shrinker
    • A number of bugs in the resource shrinker were fixed, and it now logs all of its operations into resources.txt in the same folder as the proguard log files

  • Incremental Java compilation
    • Enabled by default, but can be disabled by using ./gradlew -Pandroid.incrementalJavaCompile=false

    • Needs gradle 2.10 to work

2.0.0-alpha3 (2015/12/10)

  • Instant Run fixes

    • over consumption of dex id can lead to prematurely reach over 65K limit while dexing

  • Dexing in process

    • Can be enabled by setting android.dexOptions.dexInProcess = true

  • APK signing uses SHA256 if minSDK is >= 18

  • APKs can now be signed with DSA and ECDSA keys

  • AAPT/libpng warning about unrecognized sRGB profile is now logged on INFO level, so it's not visible by default.

  • Fixed an issue with duplicate AAR dependencies in test and main configurations (

1.5.0-beta1 (2015/11/02)
1.4.0-beta6 (2015/10/05)
  • Fixed incremental support for assets
  • Moved creation of SdkHandler to apply phase.
1.4.0-beta5 (2015/10/03)
  • Fixed pre-dex incremental support.
  • Fixed jacoco to ignore non class files.
1.4.0-beta4 (2015/10/01)

  • New API to manipulate .class files before they are converted to Dex.

    • Custom transforms can be created: extends, from artifact, and implements one of
      • AsInputTransform

      • CombinedTransform

      • ForkTransform

      • NoOpTransform

    • We’re looking for feedback on the API.
    • More info:
    • Beta4 changes:
      • Transform is now an abstract class

      • There’s no getType anymore, instead implement the right interface

      • Transforms can now be applied to libraries

      • transform method now receives a Context object to get access to some information about the task.

1.4.0-beta3 (2015/09/24)

  • Multi-dex support now available for test projects.

  • Test now automatically depend on

  • New API to manipulate .class files before they are converted to Dex.
    • Transform can apply to the current project, sub projects, and/or external libraries
    • Transforms are added via android.registerTransform(Transform). No need to deal with wiring tasks together.
    • We’re looking for feedback on the API.
    • More info: information about the task.
  • The Dex task is not available through the variant API anymore….

    • The API is still there but will throw an exception indicating how to fix this.
  • Some of the pipeline changes create issues with the currently released Android Studio (up to 1.4.0)
    • External libraries imports will not be resolved correctly.
1.4.0-beta2 (2015/09/15)

  • When asynchronous tasks are invoked from the Gradle build and a failure is experienced in the slave process, properly fail the gradle build with the underlying error cause.

  • Fixed issue with using jni code in experimental library plugin.

  • Allow platform version to be set separately from compileSdkVersion in experimental plugin.

  • Allow ABI specific configurations in a variant that contains multiple ABI.

  • Fix a regression in 1.4.0-beta1 where the build would fail claiming that a resource overlay had removed a resource needed by a library if an app or android library depended on multiple android libraries which depend on different versions of the same android library.

  • Allow a comma-separated list of serials in ANDROID_SERIAL when installing or running tests

  • Fix installation failure on L+ devices when the APK name contains a space.

  • Fix various issues related to AAPT error output.

  • Incremental Jacoco instrumentation should provide faster incremental builds. The Jacoco instrumenter is invoked directly by the android plugin. In order to force a newer version of the Jacoco instrumenter it should be added as a build script dependency.

  • Vector drawable support for generating PNGs at build time.

    • PNGs are generated for every vector drawable found in a resource directory that does not specify an API version (or specifies a version lower than 21).

    • This only happens if minSdk is below 21.

    • Densities to use can be set using the new "generatedDensities" property in defaultConfig or per-flavor.

  • Multiple modules (e.g. app and lib) now share the same mockable android.jar (for unit testing) which is generated only once. Delete $rootDir/build to regenerate it.

  • Multi-dex support now available for test projects.

  • Test now automatically depend on

  • New API to manipulate .class files before they are converted to Dex.
    • Custom transforms can be created (implements, from artifact
    • Transform can apply to the current project, sub projects, and/or external libraries.
    • Transforms are added via android.registerTransform(Transform). No need to deal with wiring tasks together.
    • We’re looking for feedback on the API.
    • More info:
  • The Dex task is not available through the variant API anymore….

    • The API is still there but will throw an exception indicating how to fix this.

1.4.0-beta (2015/08/24) 

  • Instead of processing java resources during the packaging of the APK,
    moved this upfront before the obfuscation tasks. This will allow
    the obfuscation tasks to have a chance to adapt the java resources
    following packages obfuscation

  • made java resources extraction from libraries incremental tasks.
  • Fixed issue with using jni code in experimental library plugin.

  • Allow platform version to be set separately from compileSdkVersion in experimental plugin.

  • Prevent a consumer of a library removing a resource from that library, which would lead to a runtime NoSuchFieldError.

  • Allow a comma-separated list of serials in ANDROID_SERIAL when installing or running tests

  • Fix installation failure on L+ devices when the APK name contains a space.

  • Fix various issues related to AAPT error output.

  • Vector drawable support for generating PNGs at build time.

    • PNGs are generated for every vector drawable found in a resource directory that does not specify an API version (or specifies a version lower than 21).

    • This only happens if minSdk is below 21.

    • Densities to use can be set using the new "generatedDensities" property in defaultConfig or per-flavor.

  • Multiple modules (e.g. app and lib) now share the same mockable android.jar (for unit testing) which is generated only once. Delete $rootDir/build to regenerate it.

1.3.1 (2015/08/11) 
  • fixed issue when ZipAlign task would not consume previous' task output when it the file name is customized.
  • fixed packaging of Renderscript with NDK
  • Keep the createDebugCoverageReport task name.
  • Fix customized archiveBaseName handling : see 
  • fixed for
1.3.0 (2015/07/30) 
  • added experimental-plugin with ndk support. 
  • When building aar, do not provide automatic @{applicationId} placeholder in manifest merger.
  • Introduce support for incremental compilation support with Jill and Jack.
  • By default, "LICENSE" and "LICENSE.txt" are excluded when creating an APK.
  • This can be changed from the DSL:
    android {
        packagingOptions.excludes = []
  • New sourceSets task for inspecting the set of all available source sets.
  • Unit tests recognize multi-flavor and per-variant source folders (e.g.testDemoDebug). Android tests recognized multi-flavor source folders.
  • Unit testing improvements
    • Run javac on main and test sources, even if useJack is true.
    • Correctly recognize per-build-type dependencies.
  • Added support for controlling the thread pool size for android tasks on the command line or in the file. The following example sets this to 4:
    ./gradlew <tasks>
  • It's now possible to specify instrumentation test runner arguments in build.gradle (in defaultConfig or per flavor):
    android {
        defaultConfig {
    testInstrumentationRunnerArguments size: "medium"
    This can also be done on the command line:
    ./gradlew cC 
1.2.2 (2015/04/28)
1.2.1 (2015/04/27)
  • Added support for 280dpi resources.
1.2.0 (2015/04/26)
  • More fixes to the dependency management to speed things up.
  • Added Enable flag to splits configuration for language.
  • Upgraded Proguard to 5.1
  • DSL: new code block for configuring the test tasks, see Unit testing support.
  • Unit testing:
    • Java-style resources are put on the classpath.
    • Final modifier is stripped from public instance fields in the platform jar.
  • Test-only ProGuard files. When running instrumentation tests (i.e. connectedCheck) against a minified variant, the test APK needs to be processed by ProGuard to
    rename references to code 
    in the main APK. Flags for this ProGuard run (mostly for silencing warnings) can now be specified like this:
    android.buildType.minified.testProguardFile ""
1.2.0-beta1 (2015/03/25)
  • Mainly a bug fixing release with very few new features.
  • Better support for unit tests (libraries can now have unit tests, etc...)
  • Added timeOut option to adbOptions to set the timeout when installing APKs on devices.
  • Performance improvements during project evaluation.
1.1.3 (2015/03/06)
  • Fixed issue with duplicated dependencies on test app that triggered a Proguard failure with duplicate inclusion exception.
  • Fix Comparator implementation which did not comply with JDK Comparator contract, was flagged by JDK7 as an error.
    1.1.2 (2015/02/26)
    • Path is normalized when creating mockable jar for unit testing.
    • Fixed an issue where "archivesBaseName" setting in build.gradle was ignored.
    • Unresolved placeholder failure in manifest merger when building library test application.
    1.1.1 (2015/02/24)
    • Only variants that package a Wear app will now trigger building them.
    • Dependency related issues now fail at build time rather than at debug time. This is to allow running diagnostic tasks (such as 'dependencies') to help resolve the conflict.
    • Calling android.getBootClasspath() is now possible again.
    1.1.0 (2015/02/17)
    • Unit testing support. Unit testing code is run on the local JVM, against a special version of android.jar that is compatible with popular mocking frameworks (e.g. Mockito).
      • New tasks: test, testDebug/testRelease, testMyFlavorDebug (when using flavors).
      • New source folders recognized as unit tests:
        src/test/java, src/testDebug/java, src/testMyFlavor/java etc.
      • New configurations for adding test-only dependencies, e.g.
        testCompile 'junit:junit:4.11'
        testMyFlavorCompile 'some:library:1.0'
      • Not compatible with Jack at the moment.
      • New option, android.testOptions.unitTests.returnDefaultValues to control the behaviour of the "mockable" android.jar.
    • Task names that used to contain 'Test', e.g. 'assembleDebugTest' now use 'AndroidTest', e.g. 'assembleDebugAndroidTest'. This is to distinguish them from the unit test tasks, e.g. 'assembleDebugUnitTest'.
    • ProGuard configuration files are no longer applied to the test APK. If minification is enabled, the test APK will be processed by ProGuard only to apply the mapping file generated when minifying the main APK.
    • Fixes and changes to the dependency management:
      • Properly handle 'provided' and 'package' scopes to do what they should be doing.
      • 'provided' and 'package' cannot be used with Android Libraries, and will generate an error
      • sync tested and test dependency trees:
        • if the same version of an artifact is present in both, it'll get skipped in the test app.
        • if the version is different it'll generate a build error. Gradle provides mechanism to resolve this.
    • Added support for anyDpi resource qualifier in the resource merger.
    • Projects with large number of Android Modules will see evaluation and IDE sync speed improvements (YMMV)

    1.0.1 (2014/1/9)
    • Fix 81638 : Fix PermGen issue when running extractAnnotations.
    • Fix small manifest merger issues when importing libraries with targetSdkVersion < 16
    • Fix density ordering when running with JDK8.
    • Fix 82662 : Disable passing --no-optimize to dx.

    1.0.0-rc4 (2014/12/04)
    • Handle local jars in tests of multidex-enabled library projects
    • Fix path normalization (for unzipped aars) when path is only 1 char long
    • Fix Jack/Jill memory setting through dexOptions.javaMaxHeapSize
    1.0.0-rc3 (2014/12/03)
    • Better handling of destination paths to unarchive AARs based on groupId/artifactId/version that contain characters not valid in folder names.
    1.0.0-rc2 (2014/12/03)
    • Enhanced manifest merger logging by specifying library coordinates.
    • Allow manifest placeholder to be of any type as long as toString() is implemented.
    • Fixed issue where a library with a low targetSdk would add permissions due to a declared permission in a different manifest.
    • Better fix for issue where embedding a micro app could add new permissions to the main app manifest.
    • Added check for conflict between density splits and resConfig property.
    • test applications are now not using multi-dexing, unless they test a library project.
    • Fixed lint issues 80872, 80834, 60416, 80837
    1.0.0-rc1 (2014/11/24)
    (OK this is the real RC1)
    • Fixed issue in resources shrinking
    • Fixed issue in publishNonDefault
    • Install task on 21+ devices now does a reinstall again.
    • Density split using aapt 21+ now use --preferred-density allowing for missing density version of some bitmaps.
    • hasProperty() will now work again on read-only wrapper returned by the variant API.
    • Setting applicationId(Suffix) in a Library project will now properly fail.
    • Fixed issue where embedding a micro app could add new permissions to the main app manifest.
    0.14.4 (2014/11/19)
    • This should be considered 1.0-RC (sort of, see above)
    • Fixed proguardFiles DSL issue.
    • Fixed compatibility with Studio 0.9.x
    • Compatible with Gradle 2.1, 2.2 and 2.2.1
    0.14.3 (2014/11/18)
    • Variant Specific BuildConfigField/resValue
    applicationVariants.all { variant ->
        variant.buildConfigField "int", "VALUE", "1"
        variant.resValue "string", "name", "value"
    • Variant (and multi-flavor) specific dependency configuration
      multi-flavor is all the flavors without the build Type. Only exists for 2+ dimensions of Flavors.
      Current limitation: Requires defining the configuration manually first (run the dependencies task to see the names)
    configurations {

    android {
        productFlavors {
            foo { ... }

    dependencies {
        fooDebugCompile '...'

    • BuildType/Flavor/Variant configuration for embedding wear app (<name>WearApp)
    • Upgrade to Proguard 5.1
    • Almost 1.0: removed deprecated properties/methods
      • BuildConfig.PACKAGE_NAME (use new field name)
      • android.flavorGroups (use new property names)
      • ProductFlavor.packageName/flavorGroup/testPackageName/renderscriptSupportMode (use new property name)
      • BuildType.runProguard/packageNameSuffix/jniDebugBuild/renderscriptDebugBuild/zipAlign (use the new property name)
      • Variant.packageApplication/zipAlign/createZipAlignTask/outputFile/processResources/processManifest (use the variant output)
    0.14.2 (2014/11/10)
    • Fix potential multi-dex issue where the dex files could be renamed during packaging, leading to the wrong main dex file being used.
    • Fix versionNameSuffix support
    • Fix BuildType.initWith to copy shrinkResources flag
    • setup default proguard rule file if none are provided (SDK/tools/proguard/proguard-android.txt)
    • BuildType.pseudoLocalesEnabled flag to include fake locales in apk.

    0.14.1 (2014/11/03)
    • Fix coverage support.
    • Fix resource shrinking for style references
    • Exclude embedded Wear micro-app from resource shrinking.

    0.14.0 (2014/10/31)
    • Requires Studio 0.9
    • Proguard and code coverage can now work together
    • Support for pulling coverage data from Android 5.0 devices
    • Env var ANDROID_SERIAL (if present) restrict installation/execution of tests to device matching the serial number
    • Multi-Dex support.
      • Requires Build-Tools 21.1.0, and Support repository rev 8.
      • multiDexEnabled = true on defaultConfig, ProductFlavor, or BuildType
      • Works for minSdkVersion 21+ (native) or <21 (legacy mode, with automatic dependency on
      • See multiDex samples.
    • Support for automatic removal of unused resources
      • Off by default for now, enable by setting shrinkResources to true in your release build types. Requires minifyEnabled as well.
    • DSL/API changes:
      • Renamed a few properties to make things more consistent.
        • BuildType.runProguard                 ->  minifyEnabled
        • BuildType.zipAlign                    -> zipAlignEnabled
        • BuildType.jniDebugBuild               -> jniDebuggable
        • BuildType.renderscriptDebug           -> renderscriptDebuggable
        • ProductFlavor.renderscriptSupportMode -> renderscriptSupportModeEnabled
        • ProductFlavor.renderscriptNdkMode     -> renderscriptNdkModeEnabled
      • BuildType/ProductFlavor/SigningConfig queried through the variant and variantFilter API are now read-only.
        • These objects have always been global and changing them would have side effects in other variants
        • Merged flavor is still per-variant and can me modified
      • Variant / VariantOutput API change
        • Getting the value of the density or ABI filter is done with
        • See densitySplit sample

    0.13.3 (2014/10/06)
    0.13.2 (2014/09/26)
    • Fixed issue in manifest merger that could put wrong uses-sdk node in the manifest.
    0.13.1 (2014/09/22)
    • Added ability to merge Instrumentation element from test
    • Fix uninstallAll task
    • Fix issue where bad configuration could lead to no outputs on variants which would prevent evaluation of the project.
    • connectedCheck will now fail if no tests are found.
    0.13.0 (2014/09/18)
    • Requires Gradle 2.1
    • It is now possible to provide a manifest for test apps (src/androidTest/AndroidManifest.xml)
    • AndroidManifest files in Library project can now include placeholders. If they cannot be resolved in the libraries, they'll be resolved in the consuming project.
    • AndroidManifest placeholder can now be setup on Product Flavors and Build Types.
    • Variant.getMappingFile() API now allow querying for the proguard mapping file.
    • New Split mechanism for Density and ABI driven multi-apk. Documentation here.
    • Bug fixes:
      • Fix issue where consumer proguard file (from aars) are ignored on first build
      • Fixed aar output names so that variants do not overwrite each other
      • Properly merge declare-styleable to contain all attrs.
      • Fix whitespace issue in resource strings during resource merge.

    0.12.2 (2014/07/16)
    • Fix packaging of wear application
    • Fix issue with ${applicationId} placeholder when build.gradle doesn't customize it.
    • Custom Java code generation steps now part of the source generation steps (fix IDE integration).
    • Move unzipped aar back in each project as a temporary fix for a possible race condition.
    0.12.1 (2014/07/01)
    • Fix merging of the package attribute in the manifest.
    0.12.0 (2014/06/25)
    • New IDE Model, requires Studio Beta 0.8
    • Fixes in the manifest mergers.
    • Fix issue with artifact depending on android.jar artifact on MavenCentral.
    • Fix issue with missing custom namespace declaration in generated manifest.
    • Fix issue with validation of permission group in manifest merger.

    • Updated IDE model, requires Studio 0.6
    • Supports Gradle 1.10, 1.11, 1.12.
    • New Manifest merger is now the default merger.
      • lots of fixes.
      • Added ability to add custom placeholders for manifest on flavor objects
        defaultConfig {
            manifestPlaceholders = [ activityName:"defaultName"]
    • Moved files and folders around in the buildDir for better IDE integration.
    • Generated APK can now be published. Same configuration as libraries with defaultPublishConfig and publishNonDefault flags.
    • Breaking API/DSL Changes:
      • ProductFlavor.packageName is now applicationId. Setters for packageName are still temporarily present but will disappear in 1.0
      • ProductFlavor.testPackageName is now testApplicationId. Setters for testPackageName are still temporarily present but will disappear in 1.0
      • minSdkVersion/targetSdkVersion on ProductFlavor is now a ApiVersion instance instead of an integer.
        • DSL impact
          • Cannot use setter in DSL, use method instead. Basically, do not use '='
            flavor {minSdkVersion = 9 }
            replaced with :
            flavor { minSdkVersion 9 }
          • This is due to a groovy limitation preventing overloaded setters.
        • interface ApiVersion {
              int getApiLevel();
              int getCodename();

    • Fix manifest merger bugs (including proper location of the application node in the generated manifest)
    • Fix issues where flavors in library with different packages would not generate the right R class.
    • Fix issue when parsing BOM in UTF8 encoded XML files.
    • Lint fixes
    • No release due to a problem during the push.
    • More fixes on the Manifest merger, including better handling of minSdkVersion.
    • More lint fixes.
    • Fixed incremental dex support (still needs to be enabled)
    • fixed some issues with the new manifest merger. Please keep sending us feedback.
    • fixed issue with uninstall task.
    • lots of lint fixes and new checks. For instance you can use lint to enforce resource prefix in your library.
    • Supports Gradle 1.10, 1.11, 1.12.
      • Gradle 1.12 will require Studio 0.5.8
    • New manifest merger.
      • Disabled by default. Enable with android.useOldManifestMerger = false
      • See documentation here.
    • Test code coverage support with Jacoco
      • Enable in the tested Build Type with testCoverageEnabled = true
      • HTML and XML Report generated in build/reports/coverage
      • Configure version of Jacoco with
        android {
          jacoco {
            version = ''
      • Known issue: This is not compatible with using Dagger.
    • Resource Prefix support.
      • Setup the prefix in your library with
        android {
          resourcePrefix 'mylib_'
      • Starting with Studio 0.5.8 Lint will warn you or resources not using the prefix. (Work in Progress)
    • Pre-dex cache (in rootProject/build). Shared across modules and variants. Should speed up builds.
    • Exploded aar are extracted in a single location (under rootProject/build) to share across all modules using it. May speed up builds.
    • Upgraded to Proguard 4.11. Fixed incremental issues.
    • Fixed incremental issues with aidl files.
    • variant API to access the proguard task is now under the generic name "obfuscation".
    • Aapt-based PNG processor is now default again while we investigate some issues with the old one.
    • flavorGroups have been renamed flavorDimensions and the DSL has been updated. The old DSL is still available until 1.0 at which time it'll be removed.

    • It's now possible to include a file when there's a conflict during packaging:
          android.packagingOptions {
              pickFirst 'META-INF/foo.txt'

    • New PNG processor.
      • Should be much faster when processing many files
      • Fix issue where crunched png are bigger than original file
      • To revert to the old cruncher: android.aaptOptions.useAaptPngCruncher = true
        WARNING: We've seen reports of the new processor generating PNGs that make the app crash on GB
    • The plugin now enforces that all library dependencies have a unique package name.
      • To disable this you can use android.enforceUniquePackageName = false
      • WARNING: The ability to disable enforcement will disappear in 1.0
    • Fixes:
      • Generated POM files now have the proper dependencies even if the pom object is manipulated in build.gradle
      • libraryVariant API now gives access to the list of flavors.
      • fixed issue where changes to the manifests of libraries didn't trigger a new manifest merge.
      • BuildConfig.VERSION_NAME is always generated even if the value is not set in the current variant.
      • BuildConfig is now packaged in libraries. This requires that all your libraries have a unique package name.
        • If you are disabling enforcement of package name, then you should disable packaging of BuildConfig with: android.packageBuildConfig = false
        • WARNING: the ability to disable packaging will disappear in 1.0
    • Compatible with Gradle 1.10 and 1.11
      • Using Gradle 1.11 requires Android Studio 0.5.0
      • DSL for Library Projects is now the same as for application projects.
        • You can create/configure more build types, in the buildTypes { ... } container.
        • You can create product flavors using the productFlavors { ... } container.
        • You can create signingConfigs using the signingConfigs { ... } container.
      • instrumentTest was renamed androidTest
        • This is more inline with what the tests are: all type of tests that are run on Android (unit test, instrumentation test, and later uiautomator)
        • Both the default folder names and the android.sourcesets object have been renamed.
        • To migrate you can either rename the folders or point the sourcesets to the old location(s).
      • Dependency configurations for Library Projects are now provided, compile, and publish.
    • Library Publication
      • Variants of libraries can now be published, though by default only the default variant is published. This is a work in progress.
      • TL;DR: this will NOT fix bug 52962, where release variant of the libraries are always used.
      • It does allow you to manually depend on a specific variant of a library. See documentation.
      • change the default with android.defaultPublishConfig
      • enable publication of other variants with android.publishNonDefault = true
      • Reference specific variant with compile project(path: ':project', configuration: 'flavor1Debug')
      • See documentation.
    • Ability to skip some variants. This allows you to not create all possible combinations of build types/flavors.
      • DSL is: android.variantFilter { variant -> ... }
      • The object passed to the closure implements the following methods:
        • public void setIgnore(boolean ignore);
        • @NonNull public ProductFlavor getDefaultConfig();
        • @NonNull public BuildType getBuildType();
        • @NonNull public List<ProductFlavor> getFlavors();
      • To skip a variant, call setIgnore(true).
      • This cannot be used in afterEvaluate.
    • The publish and apk configurations don't extend compile anymore but the composite internal configurations are still properly setup (this should not break anything).
    • Fix issue where variant specific source folders where not used for java compilation.
    • Fix for some Renderscript support mode compatibility issues. Requires Build Tools 19.0.3
    • Lots of misc fixes.
    • Fix Studio integration
    • Fix incremental compilation issue with BuildConfig fields and generated Res values.
    • Added the ability to create resource values through the DSL.
    • You can now use resValue <type>,<name>,<value> on build types and product flavors the same way you can use buildConfigField.
    • Fixed package renaming in activity-alias:targetActivity
    • Variant API improvements:
      • packageName returns the variant's package name
      • versionCode returns the (app/test) variant's versionCode
      • versionName returns the (app/test/) variant's versionName. Can return null.
    • Misc fixes
    • Requires Gradle 1.10
    • Requires Build-Tools 19.0.0+
    • Fixed issue 64302: Add renderscript support mode jar to the dependencies in the IDE model.
    • Fixed issue 64094: buildConfigField can now replace previous values inside the same type/flavors.
    • Add support for NDK prebuilts in library projects.
    • Parallelize pre-dexing to speed up clean builds.
    • Incremental dexing re-enabled (though it'll be automatically disabled in some builds for some cases that dx doesn't support yet.)
    • Added 'provided' dependency scope for compile only (not packaged) dependencies.
      Additional scope per buildtype and flavors are also available (debugProvided, myFlavorProvided,etc...)
    • Lint improvements:
      • New "lintVital" task, run automatically as part of assembling release variants, which checks only fatal-severity issues
      • Replace Java parser in lint with ECJ; must faster and fixes bug where lint could hang on certain source constructs
      • Lint HTML report now writes links to source files and images as URLs relative to the report location
    • Variant API improvements:
      • getPreBuild() returns the prebuild task for the variant
      • getSourceSets() returns the sorted sourcesets for the task, from lower to higher priority
      • createZipAlignTask(String taskName, File inputFile, File outputFile)
        This creates and return a new zipalign task. Useful if you have a custom plugin providing custom signing of APKs.
        This also makes the assemble task depend on the new zipalign task, and wires variant.getOutputFile() to return the result of the zipalign task.
      • now receives a Configuration object to pass the dependencies to the IDE. See artifactApi sample.
    • Re-enable Java6 support

    Note: 0.7.2 requires Java7. This is a mistake. Use 0.7.3 instead.
    • Fix issue with Proguard.
    • Add packagingOptions support in Library projects.
    • Solve issue with local jar when testing library projects.
    • Fix bug with variant.addJavaSourceFoldersToModel
    • Add jniLibs folder to source sets for prebuilt .so files.
    • Lint fixes:
      • fix RTL detector
      • fix HTML report to have valid HTML
    New Samples: ndkJniLib, genFolderApi2

    • DSL to ignore duplicate files
      android {
        packagingOptions {
          exclude 'META-INF/LICENSE.txt'

    • Fix in the lint task to trigger compilation of the variants

    • Requires Gradle 1.9
    • Requires Studio 0.4.0
    • You can now have a variant specific source folder if you have flavors.
      • Only for app (not library or test). Name is src/flavorDebug/... or src/flavor1Flavor2Debug/
        • Note the camelcase naming, with lower case for first letter.
      • Its components (res, manifest, etc...) have higher priority than components from build type or flavors.
      • There is also a "flavor combination" source folder available when more than one flavor dimension is used. For instance src/flavor1Flavor2/
        • Note that this is for all combinations of *all* dimensions.
        • Its priority is higher than single-flavor sourcesets, but lower than build-types.
    • Lint improvements
      • Revamped lint integration. Lint is now run as part of the check task, and will analyze all variants and then merge the results and create a report which lists which variants each error applies to (unless an error applies to all variants). You can also run lint on a specific variant, e.g. lintDebug or lintFreeRelease.
      • Lint will no longer report errors in AAR libraries. This version of the plugin also picks up some new lint checks.
      • A new DSL allows configuration of lint from build.gradle. This is read and used in Studio
      • See 'basic' sample.
    • Build config improvements and DSL changes.
      • buildConfigLine is replaced by buildConfigField
      • Only one field per property
      • expects 3 values, type, name, value.
      • This allows overriding a value in flavor or build type.
      • See "basic" sample.
    • Build Config now automatically contain more constants for PACKAGE_NAME, VERSION_CODE, VERSION_NAME, BUILD_TYPE, FLAVOR as well as FLAVOR_<group> if there are several flavor dimensions.
    • Switch to ProGuard 4.10
    • Added ability to test proguarded (obfuscated) apps.
    • New option on product Flavor (and defaultConfig) allow filtering of resources through the -c option of aapt
      • You can pass single value (resConfig) or multiple values (resConfigs) through the DSL.
      • All values from the default config and flavors get combined and passed to aapt.
      • See "basic" sample.
    • Jar files are now pre-dexed for faster dexing.
    • Incremental dexing is currently disabled, as we have uncovered some issues.
    • Renderscript support mode.
      • See sample 'rsSupportMode'
    • New test-related DSL properties on defaultConfig and flavors:
      • testHandleProfiling: boolean, fills in the handleProfiling attribute on the instrumentation node in the manifest.
      • testFunctionalTest: boolean, fills in the functionalTest attribute on the instrumentation node in the manifest.
    • API to add new generated source folders:
      • Adding a source folder for the model (for IDE support):
        • variant.addJavaSourceFoldersToModel(sourceFolder1, sourceFolders2,...)
      • Automatically adding dependency on the task, setting up the JavaCompile task inputs and propagating folder to the model:
        • variant.registerJavaGeneratingTask(task, sourceFolder1, sourceFolders2,...)
      • See sample 'genFolderApi'
    • API to add extra artifacts on variants. This will let you register Java or Android artifacts, for instance for alternative test artifacts.
      • See sample 'artifactApi' for the API (sample is not meant to be used, it's for testing).
    • Fixed issue with parentActivityName when handling different package name in the manifest merger.
    • Allow files inside folder META-INF/ from jars to be packaged in the APK.

    • Fixed ClassNotFoundException:MergingException introduced in 0.6.2
    • Lint now picks up the SDK home from sdk.dir in
    • Error message shown when using an unsupported version of Gradle now explains how to update the Gradle wrapper
    • Merged resource files no longer place their source markers into the R file as comments
    • Project path can contain '--' (two dashes)
    • Internal changes to improve integration with Android Studio
    • Fixed issue with "lint" task when executing task "check"
    • Gradle 1.8 is now the minimum supported version
    • Default encoding for compiling Java code is UTF-8
    • Users can now specify the encoding to use to compile Java code
    • Fixed Gradle 1.8-specific bugs
      •   Importing projects with missing dependencies was broken
      •   Compiling projects with AIDL files was broken
    Setting the encoding to use for compiling Java code is as simple as:
    android {
        compileOptions.encoding = "UTF-8"

    • Proguard support for libraries. Note the current DSL property 'proguardFiles' for library now sets the proguard rule file used when proguarding the library code. The new property 'consumerProguardFiles' is used to package a rule file inside an aar.
    • Improved IDE support, including loading project with broken dependencies and anchor task to generate Java code
    • New hook tasks: preBuild and prebuild<VariantName>
    • First lint integration. This is a work in progress and therefore the lint task is not added to the check task.
    • Enable compatibility with 1.8 (though note that we later released 0.6.0 to handle additional 1.8 issues discovered after 0.5.7 was released.)
    • Enable support for Gradle 1.7
    • Fix issue preventing to use Build Tools 18.0.1
    • access to the variants container don't force creating the task.
      This means android.[application|Library|Test]Variants will be empty during the evaluation phase. To use it, use .all instead of .each
    • Only package a library's own resources in its aar.
    • Fix incremental issues in the resource merger.
    • Misc bug fixes.
    • Fixed incremental compilation issue with declare-styleable
    • Fix a crashing bug in PrepareDependenciesTask
    • Better error reporting for cmd line tools, especially if run in parallel in spawned threads
    • Fix an issue due to windows path in merged resource files.
    • Fix issue in the dependency checker.
    What's new in 0.5.0
    • IDE Model is changed and is not compatible with earlier version! Version 0.2.0+ of Studio is required.
    • Fixed IDE model to contain the output file even if it's customized through the DSL. Also fixed the DSL to get/set the output file on the variant object so that it's not necessary to use variant.packageApplication or variant.zipAlign
    • Fixed dependency resolution so that we resolved the combination of (default config, build types, flavor(s)) together instead of separately.
    • Fixed dependency for tests of library project to properly include all the dependencies of the library itself.
    • Fixed case where two dependencies have the same leaf name.
    • Fixed issue where Proguard rules file cannot be applied on flavors.
    • enable crunching for all png files, not just .9.png
    • fix dealing with non resource files in res/ and assets/
    • fix crash when doing incremental aidl compilation due to broken method name (ah the joy of Groovy...)
    • clean older R classes when the app package name has changed.
    • Fixed incremental support for resource merging.
    • Fixed issue where all pngs would be processed in parallel with no limit on the number of thread used, leading to failure to run aapt.
    • Fixed ignoreAsset support in aaptOptions
    • Added more logging on failure to merge manifests.
    • Added flavor names to the TestServer API.

    • Fixes
      • Renamed 'package' scope to 'apk'
        • variants are 'debugApk', 'releaseApk', 'flavor1Apk', etc...
        • Now properly supported at build to allow package-only dependencies.
        • Only Jar dependencies can be package-only. Library projects must be added to the compile scope.
      • Fixed [application|library|test]Variants API (always returned empty on 0.4)
      • Fixed issue in Proguard where it would complain about duplicate Manifests.
    • System requirements
      • Gradle 1.6
      • Android SDK with the Build Tools component version 17.0.0 or above
    • New Features
      • API for 3rd party Device Providers and Test Servers to run and deploy tests. API is @Beta
      • Support for ProGuard 4.9
        • enable with BuildType.runProguard
        • add proguard config files with BuiltType.proguardFile or ProductFlavor.proguardFile
        • default proguard files accessible through android.getDefaultProguardFile(name) with name being 'proguard-android.txt' or 'proguard-android-optimize.txt'
      • Implemented Gradle 1.6 custom model for IDE Tooling support
    • Fixes and other changes
      • Renamed deviceCheck into connectedCheck
      • Fixed support for subfolders in assets/
      • Fixed cases where Android Libraries have local Jars dependencies
      • Fixed renaming of package through DSL to ensure resources are compiled in the new namespace
      • Fixed DSL to add getSourceSets on the "android" extension.

    • System requirements:
      • Gradle 1.3+ (tested on 1.3/1.4). Will not be compatible with 1.5. An update will be required.
      • Android Platform Tools 16.0.2+
    • New Features:
      • Renderscript support.
      • Support for multi resource folders. See 'multires' sample.
        • PNG crunch is now done incrementally and in parallel.
      • Support for multi asset folders.
      • Support for asset folders in Library Projects.
      • Support for versionName suffix provided by the BuildType.
    • Testing
      • Default sourceset for tests now src/instrumentTest (instrumentTest<Name> for flavors)
      • Instrumentation tests now:
        • started from "deviceCheck" instead of "check"
        • run on all connected devices in parallel.
        • break the build if any test fails.
        • generate an HTML report for each flavor/project, but also aggregated.
      • New plugin 'android-reporting' to aggregate android test results across projects. See 'flavorlib' sample.
    • Improved DSL:
      • replaced with android.compileSdkVersion to make it less confusing with targetSdkVersion
      • signing information now a SigningConfig object reusable across BuildType and ProductFlavor
      • ability to relocate a full sourceSet. See 'migrated' sample.
      • API to manipulate Build Variants.
    • Fixes:
      • Default Java compile target set to 1.6.
      • Fix generation of R classes in case libraries share same package name as the app project.
      • Fixed support for windows.
      • Added support for customized sourceset. (
      • Added support for dependency per configuration.
      • Fixed support for dependency on local jar files.
      • New samples "migrated" and "flavorlib"

      Current limitations of version 0.9.x
      • NDK Integration is very basic, limited and not documented. See samples
      • No code coverage support
      • Manifest merger is very limited.
      • Library projects only expose their release variants.
      You can download a small bundle containing a few different (mostly empty) projects that show some of the build features: here

      Older docs, needs updating.

      What can you do?

      Send feedback, lots of it. And bug reports. Thanks!


      This is developed entirely in AOSP. Go to to see how to get the source code.

      For instructions on how to build, debug and test the Gradle plugin, see Building the Android Gradle Plugin.

      Contribute patches through the standard AOSP workflow, and talk to use on adt-dev.