android - 未能找到 : com. android.support :support-v4:22. 2.0

标签 android android-support-library build.gradle

我正在尝试做一个应用程序,但现在 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'
}

如有任何帮助,我们将不胜感激。

最佳答案

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

enter image description here

关于android - 未能找到 : com. android.support :support-v4:22. 2.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31088937/

相关文章:

java - 为什么 stopService(Intent) 和 stopSelf() 方法不会停止我的独特服务?

java - 两个 Intent 服务是否会生成两个不同的工作线程?

android - CollapsingToolbarLayout ImageView 不可滚动

java - 无法解析org.apache.commons:commons-lang3:3.0对等方未通过身份验证的gradle 2.2.1

android - 已签名的 apk 在 google play 商店中的兼容性为 0

android - 为什么我的 build.gradle android studio 中没有 allprojects{}?

android - 方向更改后 fragment 无法正常工作

android - Android 客户端的 Web 套接字连接失败

android - 谷歌身份验证迁移到 androidx : SignInHubActivity does not implement Lifecycle

Android CoordinatorLayout - Android 版本之间的不一致