AS使用手机热点时 IDE提示:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
分别在buildscript中的repositories和allprojects中的repositories添加如下代码
maven() {
url 'https://maven.aliyun.com/repository/jcenter'
}
maven(){
url 'https://maven.aliyun.com/repository/google'
}
maven {
url 'https://maven.aliyun.com/repository/public'
}
maven {
url 'https://maven.aliyun.com/repository/mapr-public'
}
添加完成后保存,重启AS
AS恢复正常
参考build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { maven() { url 'https://maven.aliyun.com/repository/jcenter' } maven(){ url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/mapr-public' } google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:4.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { maven() { url 'https://maven.aliyun.com/repository/jcenter' } maven(){ url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/mapr-public' } google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }