How to determine the version of Gradle?
Option 1- From Studio
In Android Studio, go to File > Project Structure. Then select the "project" tab on the left.
Your Gradle version will be displayed here.
Option 2- gradle-wrapper.properties
If you are using the Gradle wrapper, then your project will have a gradle/wrapper/gradle-wrapper.properties
folder.
This file should contain a line like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
This determines which version of Gradle you are using. In this case, gradle-2.2.1-all.zip
means I am using Gradle 2.2.1.
Option 3- Local Gradle distribution
If you are using a version of Gradle installed on your system instead of the wrapper, you can run gradle --version
to check.
What is the 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 independently of Android. Theoretically, Gradle can be used to build any kind of project, for example, a 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 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:
.
Minimum supported Gradle version is 6.1.1. Current version is 5.6.4
I faced this error. so I added the line below to build.gradle(project)
file ,dependency
part:
classpath 'com.android.tools.build:gradle:3.6.0'
and I changed distributionUrl
in gradle-wrapper.properties
file to :
https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
It solved my problem I hope solve yours too.
Update 09/21/2020
Finally, I upgrade all of my plugins and libraries and It works perfectly by gradle-6.6.1-all.zip
in gradle-wrapper.properties
file and classpath 'com.android.tools.build:gradle:4.0.1'
in Gradle project in dependencies
section.
Be careful if you use greenDAO
or sqlcipher
to upgrade correctly
How do you find out what versions of gradle is used in Android Studio
On Windows you can navigate to C:\Users\<user>\.gradle\wrapper\dists
and you can see which gradle versions have been downloaded
Android Studio gradle wrong version
Fixed it by restarting the computer.
Restarting the IDE is not good enough. After restarting computer and going into Android Studio's terminal, typing in gradle -version
shows the correct version. That's when I know it'd work. Sure enough, gradle
commands now work.
Answered this just to show how genius the IDE written by geniuses is.
How to use the latest gradle version in Android Studio
com.android.tools.build:gradle
is android's plugin for gradle. It is not the same as gradle distribution. See here for release/version information of gradle android plugin: https://maven.google.com/web/index.html?q=gradle#com.android.tools.build:gradle
To change the gradle version that the plugin uses, edit the file:
<Project>/gradle/wrapper/gradle-wrapper.properties
and change this line to the gradle verison you want:
distributionUrl=http\://services.gradle.org/distributions/gradle-2.12-all.zip
Then rebuild your project.
Do keep in mind that the android plugin version you're using may not have been tested with this brand new gradle version and could potential cause unexpected issues.
android gradle plugin to Gradle version compatibility as of Feb2020
Plugin version Required Gradle version
-- --
1.0.0 - 1.1.3 2.2.1 - 2.3
1.2.0 - 1.3.1 2.2.1 - 2.9
1.5.0 2.2.1 - 2.13
2.0.0 - 2.1.2 2.10 - 2.13
2.1.3 - 2.2.3 2.14.1+
2.3.0+ 3.3+
3.0.0+ 4.1+
3.1.0+ 4.4+
3.2.0 - 3.2.1 4.6+
3.3.0 - 3.3.2 4.10.1+
3.4.0 - 3.4.1 5.1.1+
3.5.0 - 3.5.3 6.0.1+
3.6.0+ 6.0.1+
Related Topics
Firebase (Fcm): Open Activity and Pass Data on Notification Click. Android
How to Save State During Orientation Change in Android If the State Is Made of My Classes
How to Get the Correct Orientation of the Image Selected from the Default Image Gallery
How to Find Older Versions of Eclipse Adt
How to Use Apply a Custom Drawable to Radiobutton
How to Change the Default Icon on the Searchview, to Be Use in the Action Bar on Android
Android How to Display 2 Listviews in One Activity One After the Other
Android Boot_Completed Not Received When Application Is Closed
How to Customize Share Intent in Android
"Unable to Locate Adb" Using Android Studio
How to Set Relativelayout Layout Params in Code Not in Xml
Android Design Support Library for API 28 (P) Not Working
Access the Http Response Headers in a Webview
How to Disable Past Dates in Android Date Picker
Bind/Unbind Service Example (Android)
Android ==> Memory Analysing ==> Eclipse Memory Analyzer