错误原因:Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
简单来说就是Google被墙了,如果直接用Google的链接需要翻墙,找了半天.gradle文件也没找到gradle.property文件,应该是网上教程和我的Android版本有差别,所以直接换成镜像了
在build.gradle里修改成阿里云就可以解决问题
repositories {
jcenter()
google()
maven {
url 'https://maven.aliyun.com/repository/google'
name 'aliyun'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url 'https://maven.aliyun.com/repository/google'
name 'aliyun'
}
}
}