This page is now deprecated. Redirecting to d.android.com. Last updated 04/20/17

We are releasing an early preview of Android Gradle plugin 2.5, which aims to address performance issues of large Android projects. In order to bring about these improvements, we need to introduce some breaking changes in the plugin behavior, DSL, and APIs. These breaking changes impact both build files and Gradle plugins. We may also need to introduce more breaking changes before this version reaches the stable channel. We are releasing the new plugin early so developers and plugin authors can start trying it with their projects and plugins to provide us with feedback. Who should try this early preview? Developers with large Android projects. The Android Gradle plugin 2.5 addresses performance issues for Android projects with a large number of modules. You should expect faster Gradle configuration times and all-round build performance. See section on performance for more details. Gradle plugin or custom build script authors. If you depend on the APIs provided by previous versions of the Android Gradle plugin, this version of the plugin contains breaking changes that may impact you. Please use this link to file issues if you come across breaking changes that we have not documented. Android developers who want to get ready for migration to 2.5 early. Depending on your build scripts and the Gradle plugins that your project uses, migrating your project could be trivial or it could require some effort. Make sure to read the rest of this page to see how the changes may affect you. Trying the plugin now will allow you to plan for the upcoming changes or report on unexpected issues. You can use this link to file issues.

For instructions on how to try this plugin, jump to the Trying Android Gradle Plugin 2.5 section. What’s New? Preview 2: Gradle version 4.0-20170417000025 is required. To update Gradle, change distributionUrl in your gradle-wrapper.properties file to what’s shown below: distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle- 4.0-20170417000025 +0000-all.zip

The plugin is now compatible with Butterknife and Crashlytics.

Support for some Java 8 language features is now built into the default toolchain. To learn more, read Use Java 8 language features.

This release contains all the bug fixes and performance improvements from Android Gradle 2.4, up to Preview 6. To learn more about updates included in version 2.4 of the Gradle plugin and Android Studio, read the release notes. Preview 1: Dependency resolution at execution time

Better parallelism for multi-module projects through fine grained task graph

Incremental dexing

Variant aware dependency management

Compilation avoidance

Automatic detection of implementation only changes (Gradle feature since 3.4)



New api , implementation , compileOnly and runtimeOnly configurations allow libraries to not always leak their dependencies to their consumers What to expect regarding performance The main focus of this version is to address the build performance issues of Android projects with a large number of modules. For these projects, you should experience: Faster configuration time (the times it take to configure all the gradle projects) due to delayed dependency resolution.

Dependency resolution will only happen for the projects and variants you are building.

Simple changes to code or resources should result in faster incremental build times, especially for changes in modules deep in the dependency graph of an app.

This is a first step. We are focusing heavily on improving scalability and parallelism and on improving tasks to be more incremental. You can expect more changes in later preview releases and down the line after 2.5 stable.

On a test skeleton project with ~130 modules, and large number of external dependencies, but no code/resources (located here https://github.com/jmslau/perf-android-large.git) we are seeing the following numbers:

AGP version + Gradle version AGP 2.2.0 + Gradle 2.14.1 AGP 2.3 RC1 + Gradle 3.3 AGP 2.5 Alpha-Preview01 + Gradle 3.5 Nightly Configuration (i.e. help) ~2 mins ~9 s ~2.5 s 1-line Java change (implementation change) ~2 mins 15 s ~29 s ~6.4 s

If you would like to experiment with this test project yourself, see the section Trying this plugin with a large Android test project. We would also like to encourage you to try the plugin on your own projects. If you see less performance improvements than you expected or hoped for, we are looking for feedback with build profiling. Please consider using the Gradle Profiler (https://github.com/gradle/gradle-profiler) to provide us with more data. File a bug here, and include a chrome trace of your build (using the Gradle Profiler) Where is Android Gradle Plugin 2.4? 2.4 will be coming as soon as 2.3 is stable—it’ll go through its normal release channels (canary/beta/stable).

2.5 will go through a longer preview cycle—in parallel with the preview of 2.4, due to the large number of changes. Updates and release notes about the 2.5 plugin, and eventually the matching version of the IDE will be posted here, until 2.4 reaches the stable channel. Known Issues Generating multi-apks using the splits {} block doesn’t work—use the latest stable version of the plugin instead.

Instant Run is has not been tested with this version of the plugin.

While using this plugin with Android Studio, dependencies on local AAR files are not yet supported.

Android Instant Apps (for Early Access Program partners) is not supported in this release.

Does not currently work with Protobuf plugin.

Does not currently work with the Kotlin plugin.

Does not currently work with the retrolambda plugin. However, plugin 2.5 alpha-preview 2 includes built-in support for using Java 8 language features.

We have not yet released a matching version of the Android Studio IDE to take full advantage of this plugin. Although this version of the plugin will work with Android Studio 2.3, you should not expect any Gradle sync performance improvement over using Android Studio 2.3 with Android Gradle plugin 2.3. You should expect faster Gradle sync times from this version of the plugin when it is used with Android Studio 2.4 or 2.5 (coming soon).

This plugin breaks the third party android-apt plugin. Switch to the built-in annotation processor support which has been improved to handle resolving dependencies lazily.