转自:https://maven.google.com 连接不上的解决办法_kassadin 的专栏-CSDN博客_https://maven.google.comx
先将依赖库换成ali的
maven { url "https://maven.aliyun.com/repository/google"}
maven { url "https://maven.aliyun.com/repository/public" }
maven { url "https://maven.aliyun.com/repository/jcenter" }
maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
将setting.gradle配置中的 repositories 中的依赖google()删除
repositories{
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://dl.google.com/d1/android/maven2'}
// google()
// maven {
// url 'https://maven.google.com/'
// name 'Google'
// }
}
然后就可以了,他还有一个设置代理,没有看懂操作,知道的可以说一下
在gradle.properties中加入下边代理
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=1080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
如有错误,欢迎提出,积极交流