无法同步Gradle,找不到com.android.support:support-annotations:23.3.0

时间:2016-05-04 11:19:26

标签: android gradle butterknife

安装Butter Knife依赖项会生成此错误

Error:Could not find com.android.support:support-annotations:23.3.0.
Required by:
    Butter:app:unspecified
    Butter:app:unspecified > com.jakewharton:butterknife:8.0.1
    Butter:app:unspecified > com.jakewharton:butterknife-compiler:8.0.1 > com.jakewharton:butterknife-annotations:8.0.1

Please install the Android Support Repository from the Android SDK Manager.
<a href="openAndroidSdkManager">Open Android SDK Manager</a>

我已经安装了支持库,但我仍然遇到此错误。以下是Gradle依赖关系的样子

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:support-annotations:23.3.0'
    compile 'com.jakewharton:butterknife:8.0.1'
    apt 'com.jakewharton:butterknife-compiler:8.0.1'

}

我还添加了插件apply plugin: 'com.neenbedankt.android-apt'和存储库

jcenter()
        mavenCentral()
        maven{
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }

Screenshot

4 个答案:

答案 0 :(得分:5)

更新Android支持存储库。 enter image description here

答案 1 :(得分:3)

在SDK Manager enter image description here

中更新您的Google信息库

答案 2 :(得分:0)

将以下内容添加到build.gradle文件中:

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-annotations:23.3.0'
    }
}

答案 3 :(得分:0)

一种解决方案可能是将build.gradle(模块:app)中的“ compileOnly”替换为“提供”。