首页 > 技术文章 > AS解决无法下载jcenter下的文件

shoneworn 2017-06-17 15:32 原文

最近总是遇到无法下载jcenter下的库文件,有点烦人,百度到一个方法:

给jcenter手动添加上地址:

buildscript {
    repositories {
        jcenter(){ url 'http://jcenter.bintray.com/'}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter(){ url 'http://jcenter.bintray.com/'}
    }
}

 就这样,就可以了。默认是https的,as下载的时候,会被refused。

同样道理的还有gradle-2.3.0.zip等

解决方法:

就是这样,将https,替换成http,as没有证书,会被拒的。手动下载,在本地建服务器,在这里定向过去,也是一种方法。

推荐阅读