开发中经常遇到这个问题,由其是在最近google很多网站无法访问,打开一些工程时遇到Connect to maven.google.com:443 [maven.google.com/172.217.163.46] failed: connect timed out
解决思路就是换一个服务器,阿里云搭建了相同的maven仓库,替换一下地址就行了:
修改前
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
// google()
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
allprojects {
repositories {
// google()
maven { url 'https://maven.google.com' }
jcenter()
maven { url 'http://raw.github.com/saki4510t/libcommon/master/repository/' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
修改后
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
// google()
// maven { url 'https://maven.google.com' }
jcenter()
maven {
url 'https://maven.aliyun.com/repository/google'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
allprojects {
repositories {
// google()
// maven { url 'https://maven.google.com' }
jcenter()
// maven { url 'http://raw.github.com/saki4510t/libcommon/master/repository/' }
maven {
url 'https://maven.aliyun.com/repository/google'
name 'Google'
}
}
}
网友评论