Failed to resolve com.android.support:support-annotations 26.0.1
Asked Answered
V

4

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.

Vaginectomy answered 3/9, 2017 at 13:37 Comment(1)
Possible duplicate of Failed to resolve: com.android.support:appcompat-v7:26.0.0Aceldama
P
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()
    }
}
Planchet answered 3/9, 2017 at 13:41 Comment(3)
@hackingforgirls: Please edit your question and post both build.gradle files (project-level and the module's one) in their entirety.Planchet
my bad, I have replaced it in buildscript, and not in allprojects{}. it works now, thanks!Vaginectomy
wish I found your post 2 hours agoMerrick
T
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"
    }
}

}

Trinidad answered 31/12, 2017 at 16:31 Comment(0)
R
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
}
Rosin answered 2/8, 2018 at 18:30 Comment(0)
C
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
Christoper answered 24/11, 2022 at 5:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.