Android Studio - Failed to resolve: com.android.support libraries

17,891

Solution 1

You need to add these to your build.gradle file

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:recyclerview-v7:22.1.1'
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.android.support:support-v4:22.1.1'
}

Solution 2

There is no published 22.0.1 version of those artifacts. Use a version that has been published, like 22.1.1.

Share:
17,891
George
Author by

George

Updated on July 27, 2022

Comments

  • George
    George almost 2 years

    I got 2 gradle errors when compiling.

    Failed to resolve: com.android.support:recyclerview-v7:22.0.1

    Failed to resolve: com.android.support:appcompat-v7:22.0.1

    I try to install the repositories and it starts to install v14 support libraries and after it finishes and sync's it displays the same error again. Also tried cleaning and rebuilding the project.

    Android studio version: 1.2.1.1

    Build.gradle(app)

    apply plugin: 'com.android.application'
    
    android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'
    
    defaultConfig {
        applicationId "com.piserve.geejo.mskv4"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    }
    dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'org.lucasr.dspec:dspec:0.1.1'
    compile 'com.mcxiaoke.volley:library:1.0.+'
    compile 'com.android.support:appcompat-v7:22.0.1'
    compile 'com.android.support:recyclerview-v7:22.0.1'
    }
    

    SDK Manager Screenshot

    1

  • George
    George about 9 years
    Am sorry, I had added that too. Missed to copy it while pasting it here. I have now edited the code in the first post. Getting the same error still.
  • George
    George about 9 years
    You mean the support libraries?
  • CommonsWare
    CommonsWare about 9 years
    @George: Yes. Use 'com.android.support:recyclerview-v7:22.1.1' and 'com.android.support:appcompat-v7:22.1.1', as shown in Bojan's answer.
  • George
    George about 9 years
    Ok I did that , and after cleaning and rebuilding the project I get this error: A problem occurred configuring project ':app'. > Could not resolve all dependencies for configuration ':app:_debugCompile'. > Could not find com.android.support:appcompat-v7:22.1.1. Searched in the following locations: jcenter.bintray.com/com/android/support/appcompat-v7/22.1.1/‌​… file:/home/droidspace/Android/Sdk/extras/google/m2repository‌​/com/android/support‌​/appcompat-v7/22.1.1‌​/appcompat-v7-22.1.1‌​.pom Required by: MSKv4:app:unspecified[jar also]
  • CommonsWare
    CommonsWare about 9 years
    @George: Then your Android Repository in the SDK Manager is not up to date. That's down in the Extras branch of the tree, towards the bottom of the SDK Manager contents.
  • msanford
    msanford over 8 years
    This is better-suited as a comment.
  • U.V.
    U.V. over 8 years
    @msanford if they let me write comments I would ;)
  • msanford
    msanford over 8 years
    Ah. It came up in the Triage Review queue. I guess that's something I could bring up in Meta.
  • U.V.
    U.V. over 8 years
    @msanford It seems like I can only comment on my own answers.... so another answer seems the only way to contribute anything to a question I havent answered yet... Not that I have to understand this logic, do I?
  • msanford
    msanford over 8 years
    Yeah, there are some spam-busting restrictions against that; please disregard for the time being :)