Updated Answer (Dec. 2, 2020)
Latest Gradle: 6.5
Version check:
./gradlew -v
How to update:
- Set URL:
./gradlew wrapper --gradle-version=6.5 --distribution-type=all
- Update:
./gradlew wrapper
Latest Android Gradle Plugin: 4.1.0
If you add the following code snippet to the top of your build.gradle
file. Gradle will update the build tools.
buildscript {
repositories {
google() // For Gradle 4.0+
maven { url 'https://maven.google.com' } // For Gradle < 4.0
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
}
}
Read more here: https://developer.android.com/studio/build/index.html and about version compatibility here: https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle and https://dl.google.com/dl/android/maven2/index.html.
Original Answer
I had this same error, you need to make sure your Gradle version is compatible with your Android Gradle Plugin.
The latest version of Gradle is 2.0 but you need to use 1.12 in order to use the Android Gradle Plugin.