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.
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.
Go to Terminal & Type:
gradlew --version
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
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.
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.
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.
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