failed to resolve com.android.support:appcompat-v7:22 and com.android.support:recyclerview-v7:21.1.2

AndroidRenderingAndroid Appcompat

Android Problem Overview


I installed ALL Extra and SDK API 21-22 including changed

compileSdkVersion 22 to 21 and buildToolsVersion '22.0.1' to 21.1.2.

I'm having Rendering Problems for API 22. I have tried changing the version to <= 21 but I'm still getting an error.

Android Solutions


Solution 1 - Android

These are the correct version that you can add in your build.gradle according to the API needs.

API 24:

implementation 'com.android.support:appcompat-v7:24.2.1'
implementation 'com.android.support:recyclerview-v7:24.2.1'

API 25:

implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:recyclerview-v7:25.4.0'

API 26:

implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'

API 27:

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'

Solution 2 - Android

In order to make that working I had to set:

compile ("com.android.support:support-v4:22.2.0")
compile ("com.android.support:appcompat-v7:22.2.0")
compile ("com.android.support:support-annotations:22.2.0")
compile ("com.android.support:recyclerview-v7:22.2.0")
compile ("com.android.support:design:22.2.0")

compile ("com.android.support:design:22.2.0")

Documentation states something different ([docs][1]):

com.android.support:support-design:22.0.0

[1]: https://developer.android.com/tools/support-library/features.html#design "docs"

Solution 3 - Android

Real path for Support Repository Libraries:

enter image description here

  1. You should download Support Repository Libraries.

If the problem still exists:

  1. Go to the real path of your Support Repository Libraries and check that the following folder exists:

     "ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support" 
    

    In that folder there are support libraries that can't be found. for example:

     "ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support\appcompat-v7"
    
  2. Open folder appcompat-v7 and you see folders with all available version. You should use only one of these versions in the build.gradle file dependencies or use +, for ex. 18.0.+

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

That is the path taken from grade.build dependencies file:

com.android.support:appcompat-v7:18.0.0

Refer to the real path on your HDD -->

ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support\appcompat-v7\18.0.0

If there is no such folder, you will receive the error:

"failed to resolve com.android.support:appcompat-v7:18.0.0"  

p.s. If you have Windows x64, when installing sdk and jdk, make sure that the installation path does not have Program Files(86). Brackets that add Windows may cause additional problems with resolving paths for your project. Use simple paths for your installation folder.

For example:

c:\androidSDK\

Solution 4 - Android

> Failed to find: com.android.support:appcompat-v7:22.0.0

The "I literally tried everything else" answer:

This problem will also occur if you don't have an upto date Android Support Library and Android Support Repository. Just install using the SDK manager.

Solution 5 - Android

Along with other provided solutions, make sure to have the following within project/build.gradle

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

Solution 6 - Android

in support libraries you always need to add three numbers as version number

Suppose for 22 -> you need to write it as 22.0.0, not just 22

for 22.1 -> 22.1.0

So your dependencies should look like this

compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'

I Programmers language you need to pad extra zeros.

Hope this solves your problem

Solution 7 - Android

i solve it

change 22.0.0 to 21.0.3

dependencies {

 compile fileTree(dir: 'libs', include: ['*.jar'])

//compile 'com.android.support:appcompat-v7:22.0.0'

compile 'com.android.support:appcompat-v7:21.0.3'  }

maybe i have download the com.android.support:appcompat-v7:21.0.3 but have not got the compile 'com.android.support:appcompat-v7:22.0.0'

when i use SDK Manager update my support library and support repository , the problem dismissed.

Solution 8 - Android

NOTE1: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).

NOTE2: Support library should not use a different version than the compileSdkVersion

For API 28 you can use:

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'

https://mvnrepository.com/artifact/com.android.support/appcompat-v7/28.0.0-alpha1 https://mvnrepository.com/artifact/com.android.support/recyclerview-v7/28.0.0-alpha1

All support libraries: https://mvnrepository.com/artifact/com.android.support

Solution 9 - Android

It is easier to use "+" sign in the version number. For example

compile 'com.android.support:support-v4:22.0.+'
compile "com.android.support:appcompat-v7:22.0.+"

In this case you won't have to change versions for the same API number

Solution 10 - Android

Go to Messages Gradle Sync, and Click on Install Repository and sync project. This is will install needed file in Android SDK and after syncing you will be able to create gradle or run your project.

Solution 11 - Android

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

Solution 12 - Android

Are you import them? Like this:

compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'

Solution 13 - Android

compile ("com.android.support:support-v4:22.2.0")
compile ("com.android.support:appcompat-v7:22.2.0")
compile ("com.android.support:support-annotations:22.2.0")
compile ("com.android.support:recyclerview-v7:22.2.0")
compile ("com.android.support:design:22.2.0")

paste the above code in your app gradle.

and while setting up the project select empty activity instead of blank activity.

Solution 14 - Android

Fixed my issue by changing these

compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'

to

compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.android.support:recyclerview-v7:23.0.+'

that means your target SDK version should be same as version of cardView and recyclerView and other google libraries.

targetSdkVersion 23

Solution 15 - Android

I had such dependancy in build.gradle -

compile 'com.android.support:recyclerview-v7:+'

But it causes unstable builds. Ensure it works ok for you, and look in your android sdk manager for current version of support lib available, and replace this dependency with

def final RECYCLER_VIEW_VER = '23.1.1'
compile "com.android.support:recyclerview-v7:${RECYCLER_VIEW_VER}"

Solution 16 - Android

> Tools > Android > SDK Manager

Select all of the packages that are not up to date and update them.

Solution 17 - Android

I solved the problem updating all packages from Android SDK Manager and also, I had to install Extras -> Android Support Repository.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDump ChoenthanomwongView Question on Stackoverflow
Solution 1 - AndroidpriyankView Answer on Stackoverflow
Solution 2 - AndroidfabiozoView Answer on Stackoverflow
Solution 3 - AndroidSergey OrlovView Answer on Stackoverflow
Solution 4 - AndroidPaul TotzkeView Answer on Stackoverflow
Solution 5 - AndroidAshraf AlshahawyView Answer on Stackoverflow
Solution 6 - AndroidAshok VarmaView Answer on Stackoverflow
Solution 7 - AndroidJeffery MaView Answer on Stackoverflow
Solution 8 - AndroidAniket ThakurView Answer on Stackoverflow
Solution 9 - AndroidKateView Answer on Stackoverflow
Solution 10 - AndroidRavi RanjanView Answer on Stackoverflow
Solution 11 - AndroidMakvinView Answer on Stackoverflow
Solution 12 - AndroidoldfeelView Answer on Stackoverflow
Solution 13 - AndroidAbhi SoniView Answer on Stackoverflow
Solution 14 - AndroidAbhishekView Answer on Stackoverflow
Solution 15 - AndroidAnton KizemaView Answer on Stackoverflow
Solution 16 - AndroidNaskovView Answer on Stackoverflow
Solution 17 - AndroidTonatioView Answer on Stackoverflow