Error:Could not resolve all files for configuration ...

> Error:Could not resolve all files for configuration ':app:debugAnnotationProcessorClasspath'.
 > Could not download guava.jar (com.google.guava:guava:19.0)
   > Could not get resource 'https://jcenter.bintray.com/com/google/guava/guava/19.0/guava-19.0.jar'.
      > Could not HEAD 'https://jcenter.bintray.com/com/google/guava/guava/19.0/guava-19.0.jar'.
         > Remote host closed connection during handshake

make project时遇到这样一个问题,查看日志似乎是某个东西无法下载,多方查找后发现是gardle引入ButterKnife时版本有问题,将ButterKnife版本从8.8.1改成8.4.0就好了。估计是由于我国特色导致某个下载地址不能访问。

解决办法

在build.gradle(app)中将ButterKnife的版本降低

    //noinspection GradleDependency
    implementation 'com.jakewharton:butterknife:8.4.0'
    //noinspection GradleDependency
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'

更新(2018/9/28):今天在引入okhttp时发现了同样的问题,找到了新的解决办法:
在build.gradle (project) 中buildscript和allprojects的repositories下加上阿里的仓库maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' },如下

buildscript {
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        google()
        jcenter()
    }
    ...
 }
 ...
allprojects {
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        mavenCentral()
        google()
        jcenter()
    }
}

这样就可以使用最新的版本了,而且build速度也提升不少。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值