Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to resolve com.android.support:support-annotations 26.0.1

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.

like image 531
ghita Avatar asked Sep 03 '17 13:09

ghita


2 Answers

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()     } } 
like image 56
CommonsWare Avatar answered Sep 24 '22 07:09

CommonsWare


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"     } } 

}

like image 26
papigee Avatar answered Sep 22 '22 07:09

papigee