27
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    testCompile 'junit:junit:4.12'

    // ButterKnife
    compile 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

    // Parse SDK
    compile 'com.parse:parse-android:1.16.0'
}

This is my app gradle dependencies. I don't know what to do to resolve it. I've tried installed from SDK Manager Android SDK Build Tools 26.0.1, and I also have latest version of Android support.

Divy Soni
  • 824
  • 9
  • 22
ghita
  • 2,746
  • 7
  • 30
  • 54
  • Possible duplicate of [Failed to resolve: com.android.support:appcompat-v7:26.0.0](https://stackoverflow.com/questions/45357000/failed-to-resolve-com-android-supportappcompat-v726-0-0) – ישו אוהב אותך Sep 03 '17 at 15:47

4 Answers4

67

All current editions of Google libraries reside in Google's Maven repository (maven.google.com), not in the old offline-capable support repositories.

In your project-level build.gradle file, make sure that your allprojects closure looks like this:

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

or, on Android Studio 3.0+, like this:

allprojects {
    repositories {
        jcenter()
        google()
    }
}
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
4

Even with Android Studio 3.0.+, I had to add this below (not just google() like @CommonsWare recommended), to get pass the error

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

}

flash76
  • 382
  • 3
  • 23
papigee
  • 6,401
  • 3
  • 29
  • 31
1

I resolved this issue by adding the below in project level build.gradle file.

buildscript {

    repositories {
        jcenter()
        google()

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


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

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

task clean(type: Delete) {
    delete rootProject.buildDir
}
0

I had this error:

ERROR: Failed to resolve: support-annotations

For fix it open gradle.properties file and add

android.enableJetifier=true
#this line must be too:
android.useAndroidX=true
Style-7
  • 985
  • 12
  • 27