Android Studio下载gradle慢问题处理
前言
有时候我们拿到一个Android工程,但是本机没有其所用的gradle版本,AS下载很慢甚至不能正常下载
一、下载gradle
用AS打开工程代码,发现gradle下载很慢,是在让人捉鸡。
看一下gradle版本:
果然本地没有这个版本的。
果断下一个, 链接在这。记得下载需要的版本…
二、导入gradle
打开gradle目录,因为上面打开过工程,并且AS自动下载gradle,所以该目录下已有此版本的文件夹。
将下好的gradle考进去
我这里有其他的文件是因为成功引用这个版本后生成的,第一次用的话都删除即可。
三、安排镜像
将国内镜像加到build.gradle中,直接替换原来的就可以
buildscript {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url "https://jitpack.io" }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://jcenter.bintray.com' }
google()
}
}
allprojects {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://jcenter.bintray.com' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
mavenCentral()
jcenter()
}
}
四、加载工程
上面两种方式都可以。速度很快的。