Could not find com.android.tools.lint:lint-gradle Android Studio 3

D.K. picture D.K. · Oct 27, 2017 · Viewed 68.6k times · Source

I have updated Android Studio to 3.0 and now received a lot of issues.. now stoped on point with such issue:

Could not resolve all files for configuration ':applib:_lintClassPath'.
> Could not find com.android.tools.lint:lint-gradle:26.1.0-alpha01.
  Searched in the following locations:
      file:/Users/anwender/Library/Android/sdk/extras/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
      file:/Users/anwender/Library/Android/sdk/extras/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
      file:/Users/anwender/Library/Android/sdk/extras/google/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
      file:/Users/anwender/Library/Android/sdk/extras/google/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
      file:/Users/anwender/Library/Android/sdk/extras/android/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
      file:/Users/anwender/Library/Android/sdk/extras/android/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
      https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
      https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
      https://jitpack.io/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
      https://jitpack.io/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
      file:/Users/anwender/dev/project/dk_shopping_checklist/augmented/libs/lint-gradle-26.1.0-alpha01.jar
      file:/Users/anwender/dev/project/dk_shopping_checklist/augmented/libs/lint-gradle.jar
  Required by:
      project :applib

Does someone know what the issue can be?

Gradle.build:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 26
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:+'
}

I'm using latest gradle version: "gradle-4.2.1-all.zip".

Answer

0xAliHn picture 0xAliHn · Jan 25, 2018

If you're running lint on a project that you created using an older version of Android Studio, you may encounter this error.

To resolve this issue, for each project that you would like to run lint on, include Google's Maven repository in the top-level build.gradle file, as shown below:

allprojects {
    repositories {
        // The order in which you list these repositories matter.
        google()
        jcenter()
    }
}