Error:Cause: buildToolsVersion is not specified

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.


Add buildToolsVersion to your build.gradle file this will solve your problem.

buildToolsVersion "27.0.1"

Gradle file code

 android{
          compileSdkVersion 27
          buildToolsVersion "27.0.1"
          useLibrary 'org.apache.http.legacy'
        }

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!!!


in file... build.gradle(Project: XXX):

repositories{
     //put pluging repository here
     //e.g.:
     mavenCentral()
}
dependencies{
     //classpath to plugin here
     classpath 'com.XXXX.xXXxxXX.XXXX' 
}

in file.... build.gradle(Module: app)

//add on top:
apply plugin: 'com.YOUR.PLUGIN.XXX'

The issue for me was that andorid-versionCode can only be integer value. in build.xml:

eg:android-versionCode="1"

It cannot be "1.1" etc... The error code is not helpful at all.