简体   繁体   中英

Failed to Sync Gradle, could not find com.android.support:support-annotations:23.3.0

Installing Butter Knife dependencies generates this error

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>

I have installed support library but it still I get this error. Here is how Gradle dependencies look like

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'

}

I have also added plugin apply plugin: 'com.neenbedankt.android-apt' and repositories

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

截图

Update Android Support Repository. 在此输入图像描述

Update your Google Repository in SDK Manager 在此输入图像描述

add the following to your build.gradle file :

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

一种解决方案可能是在build.gradle(Module:app)中用“compileOnly”替换“提供”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM