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.
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
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
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"
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
Source: Stackoverflow.com