16

While generating APK, It's showing build failed, this is the error message :

    Could not find com.android.tools.lint:lint-gradle:26.1.1.
Searched in the following locations:
    file:/C:/Users/Abde/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/lint/lint-gradle/26.1.1/lint-gradle-26.1.1.pom
    file:/C:/Users/Abde/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/lint/lint-gradle/26.1.1/lint-gradle-26.1.1.jar
    file:/C:/Users/Abde/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/lint/lint-gradle/26.1.1/lint-gradle-26.1.1.pom
    file:/C:/Users/Abde/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/lint/lint-gradle/26.1.1/lint-gradle-26.1.1.jar
    file:/C:/Users/Abde/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/lint/lint-gradle/26.1.1/lint-gradle-26.1.1.pom
    file:/C:/Users/Abde/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/lint/lint-gradle/26.1.1/lint-gradle-26.1.1.jar
    https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.1/lint-gradle-26.1.1.pom
    https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.1/lint-gradle-26.1.1.jar
Required by:
    project :app

Help me ! thank you

Alex Bene
  • 233
  • 2
  • 3
  • 10

4 Answers4

28

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

Your top-level project build.gradle ought to have the google() repository in order to fetch this dependency like this:

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

Note that: The google() repo is a shortcut to looks in Google's Maven repository for dependencies. It was introduced with Gradle v.4.0 (required Android Studio 3.x and Gradle plugin 3.x).

In any case (Android Studio 2.x, gradle plugin 2.x.x, or gradle v3.x) you can use the same maven repo using maven { url 'https://maven.google.com' }. It is the same.

nhoxbypass
  • 9,695
  • 11
  • 48
  • 71
  • 3
    Hello. I have the same problem but i do have the google() repo. Any other thoughts? – Wolforce May 16 '18 at 12:15
  • I had google() already in my repositories section. Doing @SachinTyagi recommendation works for me. His recommendation is to add the following to the repository section: maven { url 'https://maven.google.com' } – Judah Gabriel Himango Aug 30 '18 at 21:23
  • The only solution that worked for me was to go to Build --> Build Types, and add google() to both repos – Chop Labalagun Oct 10 '18 at 00:55
  • What worked for me was to move the `google()` entry above the `jcenter()` one, i.e, change the order of the entries. – forumulator Nov 26 '18 at 21:09
  • if you already have google() repo but still having this error check this: https://stackoverflow.com/a/63016468/4565796 – Saeed Arianmanesh Jul 21 '20 at 14:15
6

make sure the google() repo for repositories is in both your buildscript and allprojects sections.

user330844
  • 872
  • 1
  • 12
  • 12
-1

For those who experience the same problem, try adding this to App Builde.gradle :

android {
    //the rest of the code above

    lintOptions {
       disable 'MissingTranslation'
    }
}

I had the same problem, and this, for whatever reason, worked for me.

Ayoub Laazazi
  • 540
  • 7
  • 15
-3

First Generate : cacerts file

$ keytool -importkeystore -srckeystore {your-home-directory}\.AndroidStudio3.0\system\tasks\cacerts -destkeystore .\cacerts -v

then add this code in gradle.properties

systemProp.javax.net.ssl.trustStore=C:\\ProgramFiles\\Java\\jdk1.8.0_171\\jre\\lib\\security\\cacerts

systemProp.javax.net.ssl.trustStorePassword=changeit
Zaki Alam
  • 25
  • 4