Gradle: Guide to versions (+Android)

Written on June 3, 2016

When using Gradle I always forget where to look to make sure I’m taking advantage of the latest core and android plugin versions for my project.

Some of the below can be done via Android Studio but I like knowing how to do stuff without the IDE :)

Core Gradle

You can check the version of Gradle installed on your system with gradle --version.

Installation & Updating

I use brew and for initial installation use brew install gradle and to update brew update && brew upgrade gradle.

Core Gradle Android Wrapper

You should always run commands via the Gradle Wrapper (gradlew) so you have deterministic builds, regardless of the Gradle core version that’s installed on the current build machine.

You can check the wrapper version by running gradlew --version.

You can update it by editing the gradle-wrapper.properties distributionUrl or by defining a wrapper task (Recommended as the format of the properties file can change) with

task wrapper(type: Wrapper) {
    gradleVersion = '<coreVersion>'
}

and calling gradle wrapper.

Gradle Android Plugin

The Gradle Android plugin major.minor version tracks the build tools versioning.

This is defined in your build.gradle with classpath 'com.android.tools.build:gradle:<pluginVersion>'