【问题标题】:Failed to find: com.android.support:support-v4:22.2.0找不到:com.android.support:support-v4:22.2.0
【发布时间】:2015-06-27 12:47:43
【问题描述】:

我正在尝试做一个应用程序,但现在 gradle 文件似乎有一些错误。在我升级支持库之前它工作正常。 我正在使用运行良好的 api 21,但后来我升级到 api22 并相应地更改了 gradle 文件。现在出现了这个错误。

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

这是我当前的 gradle 文件:

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

任何帮助将不胜感激。

【问题讨论】:

  • 如果将compile 'com.android.support:support-v4:22.2.0'添加到依赖列表会发生什么?
  • @Blackbelt:我也得到了同样的错误。
  • 你使用的是哪个 gradle 版本?如果过时使用最新版本并编译
  • compile ('com.android.support:design:22.2.0'){ exclude module: 'support-v4' exclude module: 'appcompat-v7' }..尝试添加这个
  • 打开您的 SDK 管理器并将构建工具和支持库升级到最新版本。

标签: android android-support-library build.gradle


【解决方案1】:

如果这可能对某人有所帮助,经过多次试验和错误后,我发现我在对应于“库”的 build.gradle 文件中定位了错误的 SDK 版本(较旧的版本)。要更改此设置,您可以手动或转到模块设置菜单(右键单击您的项目文件夹 -> 打开模块设置。然后在“库” - 属性中,您可以更改编译 SDK 和构建工具版本

【讨论】:

  • 在更新了所有支持库和构建工具之后,这显然对我有用。
【解决方案2】:

使用 Android SDK 管理器。转到Extras 然后Android Support Repository 并将其更新到最新版本。

(这基本上是@natario 的评论,但它应该是一个答案。)

【讨论】:

    猜你喜欢
    • 2015-11-24
    • 1970-01-01
    • 1970-01-01
    • 2014-08-27
    • 1970-01-01
    • 1970-01-01
    • 2019-03-28
    • 1970-01-01
    相关资源
    最近更新 更多