07 July 2021
Could not resolve com.android.tools.lint:lint-gradle

The Problem

From time to time (perhaps when trying to build or upgrade an older Android project), you may run into the following exception:

Could not resolve com.android.tools.lint:lint-gradle:27.1.1

You’ll usually only find this while performing a release build. Linting is an automated process that checks your code for stylistic or programmatic errors.

Gradle helpfully tries to do this as part of the build process, but clearly it cannot find the linting library,

The Solution

The solution is trivial, in your top-level build.gradle file, add the following line to your repositories block:

allprojects {
    repositories {
        google()
        ...
    }
}

This tells Gradle that it can look in the official Google repository while finding dependencies.