5

This issue has been incredibly frustrating for me for the past two weeks.

Using the Android SDK Manager, I updated the following:

Tools:

Android SDK Tools rev. 24.3.3
Android SDK Platform-tools rev. 22
Android SDK Build-tools rev. 22.0.1

Android 5.1.1 (API 22):

SDK Platform rev. 2
Google APIs rev. 1
Sources for Android SDK rev. 1

Extras:

Android Support Repository rev. 16
Android Support Library rev. 22.2.1
Google Repository rev.22

This is the exact list of all the repositories that I've installed and updated to with the Android SDK Manager.

However, when I attempt to add the line:

compile 'com.android.support:design:22.2.0'

Gradle becomes stuck on addDependecies. Furthermore, when I go to Module Settings, and then to Dependencies, when I try to add a new library, the 'com.android.support:design:22.2.0' does not appear within the list!

Here's additional information about my target, compile, and minimum SDK version:

android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
    applicationId "com.myandroidapplication.newtestapp"
    minSdkVersion 14
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}
}

What could I possibly be missing at this point? Thank you!

waylonion
  • 6,866
  • 8
  • 51
  • 92
  • 1
    Have you considered using version 22.2.1 of the design library instead? It should fix many of the issues that were present in original 22.2.0 version. – harism Jul 31 '15 at 21:25
  • I haven't even been able to add version 22.2.0 of the design library, much less, version 22.2.1. Android Studio does not display these libraries when I attempt to find them in the Dependencies tab within Module Settings! – waylonion Jul 31 '15 at 21:27
  • 2
    Doesn't it say you have updated "Android Support Library rev. 22.2.1" then why are you using 22.2.0 which isn't installed. – Sharjeel Jul 31 '15 at 21:28
  • 1
    WOW! I didn't think that the numbers had to match up exactly! I just thought that installing the latest version would allow me to use any of the older versions as I was following along with a tutorial. Thank you so much for clarifying this! It's FINALLY working. Thank you!! – waylonion Jul 31 '15 at 21:35
  • try invalidating caches/restarting android studio Edit: Nvm you fixed it :-) – Nick H Jul 31 '15 at 21:36
  • @WayWay you are welcome. I have posted it as answer as well. Now if you update to next version in future, you will still be able to use 22.2.1 as you have installed it once. It seems like you never installed 22.2.0 before that's why the error. – Sharjeel Jul 31 '15 at 21:41
  • how exactly did you install this version? My app uses a compilesdk =21 but I can only find com.android.support:design:24.2.1 in android studio or my SDK manager. – Cody Sep 22 '16 at 04:43

2 Answers2

13

You have to use version 22.2.1 as it has installed on your computer.

compile 'com.android.support:design:22.2.1'
Sharjeel
  • 15,588
  • 14
  • 58
  • 89
1

For me, I was initially adding the support library dependency by typing it out in the build.gradle of my app directly. I cleaned the line that I had typed and added the dependency through the android studio GUI,

  1. Go to File
  2. Choose Project Structure
  3. Click on the Dependencies tab
  4. Click on the + symbol in the upper right conner and choose Library Dependency.
  5. Search for and add the support library in the dialog that appears
  6. Gradle build/sync should start automatically.

Don't know why, but it works for me at least.

Prince Odame
  • 534
  • 7
  • 17