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

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”.

Enquirer: D.K.

||

Solution #1:

It looks to me like you’re missing the google() repository in order to fetch the dependency.

Here’s the link to the pom file that you’re looking for: https://dl.google.com/dl/android/maven2/com/android/tools/testutils/26.1.0-alpha01/testutils-26.1.0-alpha01.pom

Respondent: Niklas

Solution #2:

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()
    }
}
Respondent: 0xAliHn

Solution #3:

I solved this by adding the https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api
repo to build.gradle:

repositories {
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
    jcenter()
    maven {
        url 'https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api'
    }
}
Respondent: Tom Aranda

Solution #4:

My answer is for everyone that Already have google() in repositories but still have same error

  1. goto android studio settings and search for “HTTP Proxy” and make sure you haven’t set a wrong proxy there. (set it to auto-detect proxy settings if not sure)
  2. close android studio
  3. goto C:/Users/DESKTOP-NAME/ and Delete .gradle folder (yes, it’s big folder but don’t be scared its just keeping all versions of your old gradle files that is not needed now)
  4. goto you project folder and delete .gradle folder and app/build folder (make a backup before this just in case)
  5. restart your PROXY server Or VPN provider (if you use one) and make sure you have a working internet connection.
  6. Open Android Studio and wait until successful build (it’s gonna take a little longer).
Respondent: Saeed Arianmanesh

Solution #5:

I have changed my current gradle version(3.3.2 to 3.2.1) from the global build.gradle file.

buildscript {
 repositories {
    google()
    jcenter()
    maven { url 'https://maven.google.com' }
 }

 dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
 }
}

allprojects {
 repositories {
    google()
    jcenter()
    maven { url 'https://maven.google.com' }
 }
}

then click on sync gradle button on the top right corner of the screen.

Respondent: l.mome

Solution #6:

Another option is

./gradlew -x:app:lintVitalRelease assemble

To quote Gradle Docs:

Excluding tasks from execution

You can exclude a task from being executed using the -x or –exclude-task command-line option and providing the name of the task to exclude.

Reference: https://docs.gradle.org/current/userguide/command_line_interface.html#sec:excluding_tasks_from_the_command_line

Archived link: http://archive.is/TsPPJ#sec:excluding_tasks_from_the_command_line

Respondent: 2q.

Solution #7:

just comment google and sync project

   repositories {
    google()
    jcenter()
   }

Disable offline mode and uncomment google() and sync again…

Respondent: jay patoliya

Solution #8:

Add google() to your gradle
If you face this again,Do not add a linter disabler to your gradle, This is an access error issue,I faced that on react-native after using sudo command for a few command, Just reset your code access and then release again For example the mac

sudo chmod -R 777 <project-root-folder-name>

Respondent: Mohammad f

Solution #9:

add below code to your build.gradle (Module) to skip error

lintOptions {
        abortOnError false
}
Respondent: vahid

Solution #10:

Try this,

File -> Settings -> Build,Execution,Deployment -> Gradle -> Android Studio -> Select -Enable embedded maven repository – Apply.

Respondent: keshavmurthy

Solution #11:

My has this issue,
solved by below lines

buildscript {
ext.kotlin_version = '1.3.60'

repositories {
    google()
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1' //3.4.2, 3.4.1^, 2.3.3^
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
    classpath 'com.google.gms:google-services:4.3.3' 
}
}
//################################################################################
allprojects {
    repositories
            {
                google()
                jcenter()
                mavenCentral()
                maven { url "https://dl.google.com/dl/android/maven2/" }
                maven { url "http://jcenter.bintray.com/" }
                maven { url 'https://plugins.gradle.org/m2/'}
                maven { url "https://maven.google.com" }
                maven { url 'https://jitpack.io' }
                maven { url 'https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api' }

                flatDir {
                    dirs 'libs'
                }
            }
}
//################################################################################
task clean(type: Delete) {
    delete rootProject.buildDir
}
Respondent: Ali Bagheri

Solution #12:

im my case I solved the problem by downgrading gradle version from 3.6.3:

buildscript {
repositories {
    jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.6.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
 }
}

to 3.4.2:

buildscript {
repositories {
    jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.4.2'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}
Respondent: farhad.kargaran

Solution #13:

Do not comment out google(), while applying the solutions above:

repositories {
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
    jcenter()
    google()
    maven {
        url 'https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api'
    }
}
Respondent: helpmore

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.