I create a simple project and then I right-click on the project and then I use the make mudole app
option. Now I have two build.gradle
folders: 1-
for me it was an additional classpath line for example :
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
so i was deleting the first
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
and the issue solved
Try to invalidate caches / restart , it fixed this like this after updated File-> Invalidate caches/restart
Add buildToolsVersion property to your local build.gradle file.
android {
compileSdkVersion 27
buildToolsVersion "26.0.1"
defaultConfig {
targetSdkVersion 27
}
}
As per your requirements!! Then Try to build -> you will get build failure and this message :
Failed to find Build Tools revision 26.0.1
Install Build Tools 26.0.1 and sync project
Then Click to Install build tools and your project is configured and you are good to go!!!
I had same error, I using cordova and resolve by removing the space character
id="com.xx.yy " => to id="com.xx.yy"
Might be helpful for someone:
in my case long time ago I had added keystore properties in build.gradle
file for Android:
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
and after some period of time I pulled repo and forgot to add this file ("keystore.properties").
Gradle for some reason (!) gave me the same error (buildToolsVersion
was defined a bit below in build.gradle
file).
The workaround was just to add missing "keystore.properties" file.
I had the same issue. What I was doing wrong was the placing of apply plugin statement in the root gradle of the project. When I placed it in the app gradle then the issue got resolved.
What I would suggest is to check if you are placing some statement in the root gradle that you should be placing in the app gradle.