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

匿名 (未验证) 提交于 2019-12-03 01:31:01

问题:

I installed ALL Extra and SDK API 21-22 including changed compileSdkVersion 22 to 21 buildToolsVersion '22.0.1' to 21.1.2 but error.

And Rendering Problems for API 22 and I changed to

回答1:

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

API 24:

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

API 25:

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

API 26:

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


回答2:

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):

com.android.support:support-design:22.0.0



回答3:

Real path for Support Repository Libraries:

  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\ 


回答4:

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.



回答5:

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



回答6:

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.



回答7:

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



回答8:

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.



回答9:

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

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


回答10:

Are you import them? Like this:

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


回答11:

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.



回答12:

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 


回答13:

Tools > Android > SDK Manager

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



回答14:

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


回答15:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!