Failed to find: com.android.support:support-v4:22.2.0

随声附和 提交于 2019-12-22 05:29:27

问题


I am trying to do an application but there seems to be some error with the gradle files now. It was working fine until I upgraded the support libraries. I was working with api 21 which worked fine, but then i upgraded to api22 and changed the gradle files accordingly.. Now this error shows up.

 Error:Failed to find: com.android.support:support-v4:22.2.0

This is my current gradle file :

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.example.sampleapp"
    minSdkVersion 12
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

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

Any help would be appreciated.


回答1:


If this might help someone, after MANY trials and errors, I found that I was targeting the wrong SDK version (an older one) in the build.gradle file corresponding to "library". To change this you can do it by hand or go to the Module Settings Menu (right click on your project folder -> Open Module Settings. Then in "library" - Properties you can change the Compile Sdk and the Build Tools Versions




回答2:


Using Android SDK Manager. Go to Extras and then Android Support Repository and update it to the latest version.

(This is essentially the comment @natario made, but it should be an answer.)



来源:https://stackoverflow.com/questions/31088937/failed-to-find-com-android-supportsupport-v422-2-0

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