How to determine the version of Gradle?

AndroidGradle

Android Problem Overview


How can I know which version of Gradle I am using in my Android Studio? Please guide.

I want to make sure I am using Gradle version 2.2.1.

Android Solutions


Solution 1 - Android

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.

Solution 2 - Android

I running the following in my project:

./gradlew --version

------------------------------------------------------------
Gradle 4.7
------------------------------------------------------------

Build time:   2018-04-18 09:09:12 UTC
Revision:     b9a962bf70638332300e7f810689cb2febbd4a6c

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_212 (AdoptOpenJDK 25.212-b03)
OS:           Mac OS X 10.15 x86_64

Solution 3 - Android

You can also add the following line to your build script:

println "Running gradle version: $gradle.gradleVersion"

or (it won't be printed with -q switch)

logger.lifecycle "Running gradle version: $gradle.gradleVersion"

Solution 4 - Android

At the root of your project type below in the console:

gradlew --version

You will have gradle version with other information (as a sample):

------------------------------------------------------------          
Gradle 5.1.1 << Here is the version                                                         
------------------------------------------------------------          
                                                                      
Build time:   2019-01-10 23:05:02 UTC                                 
Revision:     3c9abb645fb83932c44e8610642393ad62116807                
                                                                      
Kotlin DSL:   1.1.1                                                   
Kotlin:       1.3.11                                                  
Groovy:       2.5.4                                                   
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018  
JVM:          10.0.2 ("Oracle Corporation" 10.0.2+13)                 
OS:           Windows 10 10.0 amd64                                   

I think for gradle version it uses gradle/wrapper/gradle-wrapper.properties under the hood.

Solution 5 - Android

Go to Terminal & Type:

gradlew --version


Gradle 5.3

Build time: 2019-03-20 11:03:29 UTC Revision: f5c64796748a98efdbf6f99f44b6afe08492c2a0

Kotlin: 1.3.21 Groovy: 2.5.4 Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018 JVM: 1.8.0_181 (Oracle Corporation 25.181-b13) OS: Mac OS X 10.14.6 x86_64

Solution 6 - Android

Another solution on windows is to locate the file "gradle.bat" (usually in Gradle\bin\ directory), then you launch it from the command line and you will get the version like so:

terminal

Solution 7 - Android

Checking in gradle-wrapper.properties

Check your gradle-wrapper.properties in Android project/gradle/gradle-wrapper.properties.

You'll have something like this:
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip

Using terminal

Windows:

run gradlew --version

Mac:

run ./gradlew --version

in your project folder.

Solution 8 - Android

I found the solution Do change in your cordovaLib file build.gradle file

> dependencies { > classpath 'com.android.tools.build:gradle:3.1.0' }

and now make changes in you,

> platforms\android\gradle\wrapper\gradle-wrapper.properties > > distributionUrl=\
> https://services.gradle.org/distributions/gradle-4.4-all.zip

this works for.

Solution 9 - Android

2019-05-08 Android Studios needs an upgrade. upgrade Android Studios to 3.3.- and the error with .R; goes away.

Also the above methods also work.

Solution 10 - Android

Check in the folder structure of the project the files within the /gradle/wrapper/ The gradle-wrapper.jar version should be the one specified in the gradle-wrapper.properties

Solution 11 - Android

replace this line in android\build.gradle

classpath 'com.android.tools.build:gradle:4.0.1'

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser379888View Question on Stackoverflow
Solution 1 - AndroidBryan HerbstView Answer on Stackoverflow
Solution 2 - AndroidcuraView Answer on Stackoverflow
Solution 3 - AndroidOpalView Answer on Stackoverflow
Solution 4 - AndroidAlireza FattahiView Answer on Stackoverflow
Solution 5 - AndroidDeepikaView Answer on Stackoverflow
Solution 6 - AndroidRichardView Answer on Stackoverflow
Solution 7 - AndroidJerinView Answer on Stackoverflow
Solution 8 - AndroidMihir PatelView Answer on Stackoverflow
Solution 9 - AndroidRVscriptView Answer on Stackoverflow
Solution 10 - AndroidrockdaswiftView Answer on Stackoverflow
Solution 11 - AndroidDashrath PrajapatiView Answer on Stackoverflow