buildToolsVersion is not specified

Viewed 1593

I'm getting "Error: buildToolsVersion is not specified" I've seen many people get this error but it has either been due to buildtooslversion not being specified in the module build.gradle or apply plugin being in the top level.

Top level build.gradle

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.2.0'
            classpath 'com.google.gms:google-services:3.0.0'
        }
    }
    allprojects {
        repositories {
            jcenter()
        }
    }

    dependencies {
    }

Module build.gradle

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 28
        buildToolsVersion "28.0.2"

        defaultConfig {
            applicationId "com.tst.test_app"
            minSdkVersion 9
            targetSdkVersion 28
        }
    }

    dependencies {
        compile project(':test_app_lib')
        compile 'com.google.android.gms:play-services-ads:9.6.1'
        compile 'com.firebase:firebase-client-android:2.3.1'
        compile 'com.google.firebase:firebase-core:9.6.0'
    }

    apply plugin: 'com.google.gms.google-services'

It's been a year since I touched this code. I previously built ok. I updated android studio and SDKs and switch to target SDK28. That's pretty much all I changed.

3 Answers

add google() above jcenter() inside

repositories {
    google()
    jcenter()
}

You don't need to say which build tools are you using when you are using Android Pie

You only need to have something like this:

compileSdkVersion 28
defaultConfig {
    applicationId "your.app"
    minSdkVersion 18
    targetSdkVersion 28
    versionCode 0
    versionName "1.0"
}

And please update your dependencies from compile to implementation, like this:

implementation 'com.google.firebase:firebase-core:16.0.3'

If your minSdkVersion is currently below 14, you will need to set it to 14 or higher. This is a limitation introduced in 26.

It ended up that buildToolsVersion was not specified in the LIBRARY (test_app_lib). When I added that, the error went away

Related