解决Android Studio Gradle jar包下载不了问题
刚使用这款IDE的时候遇到新建项目不能下载jar包
原因是网络连接不通
通过代理完美解决网络问题
- 修改配置文件 build.gradle
- 初始的配置文件:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
- 增加阿里云代理即可实现jar下载
buildscript {
repositories {
maven {
url 'https://maven.aliyun.com/repository/jcenter'
}
maven {
url 'https://maven.aliyun.com/repository/google'
}
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
// 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/central'
}
maven {
url 'https://maven.aliyun.com/repository/google'
}
jcenter()
mavenCentral()
google()
}
}
总结
主要是访问地址不是国内的会出现连接超时
改为国内代理既能快速下载jar包
又能提高开发效率
阿里云仓库地址