What is real Android Studio Gradle Version?
You need to be clear about THREE things here:
- Gradle
- Android Gradle Plugin
- Gradle Wrapper
Specifically speaking,
- Gradle is a build tool which evolves itself independently on Android. Theoretically, Gradle can be used to build any kind of project, for example, typical Java project, Android Project and even iOS project. It can also be integrated with any kind of IDE, for example, Android Studio, Netbeans, or Eclipse. By the time of writing, the latest Gradle version is 4.9, and you can always check its current version from gradle installation guide. One of the great features of Gradle build tool is it supports Custom Plugins.
Android Gradle Plugin The Android Gradle Plugin is one of such gradle custom plugin. For the typical Android project, the version of this plugin can be configured in the top-level
build.gradle
.buildscript { .... dependencies { classpath 'com.android.tools.build:gradle:3.1.3' } .... }
For each version of this plugin, it requires a minimum Gradle version as listed in this page gradle-plugin or see below mapping table for a quick information: For example, Android Gradle Plugin version 3.1.0+ requires a minimal gradle version 4.4 which can be configured via Android Studio.
Gradle Wrapper. According to the official document Gradle Wrapper
The recommended way to execute any Gradle build is with the help of the Gradle Wrapper (in short just “Wrapper”). The Wrapper is a script that invokes a declared version of Gradle, downloading it beforehand if necessary. As a result, developers can get up and running with a Gradle project quickly without having to follow manual installation processes saving your company time and money.
This wrapper can be configured from
gradle-wrapper.properties
under your project directory. For example,distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
Or from the Android Studio GUI as said in your question .
classpath 'com.android.tools.build:gradle:3.1.3'
This refers to the Android plugin for Gradle.
Gradle version 4.4
This and all the other versions are for Gradle itself.
Gradle and the Android plugin for Gradle are two different pieces of software and so have different version numbers.
You are confusing two different versions.
classpath 'com.android.tools.build:gradle:3.1.3'
Indicates the version of the Android Gradle Plugin is 3.1.3. The other two fields are describing the version of the Gradle build system.
These can also be different, if you choose not to use the optional gradlew-wrapper (gradlew
) tools. I highly recommend you do use them though, they make things much easier.