今天打开Android Studio鬼使神差去点了update到3.2.1,升级完后工程就报错了。。。
错误日志:Unknown host 'd29vzk4ow07wi7.cloudfront.net'. You may need to adjust the proxy settings in Gradle
尝试了各种方法,还是报错,比如(以下方法均在Project/build.gradle中修改):
方法1:把两个 jcenter() 用 maven{ url ‘http://maven.aliyun.com/nexus/content/groups/public/’}替换 ---> 报错
方法2:在jcenter()之前添加 maven{ url'http://maven.aliyun.com/nexus/content/groups/public/'} ---> 可以下载之前报错的库,但allProject还是编译出错
方法3:删掉maven{ url'http://maven.aliyun.com/nexus/content/groups/public/'},google()放在jcenter()前 ---> 搞定
修改后的 build.gradle 如下:
buildscript {
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath'com.android.tools.build:gradle:3.0.1'
classpath'org.greenrobot:greendao-gradle-plugin:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
总结:google() 必须 在jcenter() 上,如果不行,就试试在 google() 下添加阿里云的镜像maven{url'http://maven.aliyun.com/nexus/content/groups/public/'}
网友评论