下载地址:
https://services.gradle.org/distributions/
选择版本:
点击上方链接去官网下载, 或者下载我的网盘分享:
链接:https://pan.baidu.com/s/1iqR9Ox7hJvDDGQOx-4xYGw
提取码:tlqg
安装配置:
下载后解压
配置环境变量path
;E:DevelopToolsgradle-6.8.2-allgradle-6.8.2in;
cmd输入gradle -v,返回版本信息表示配置成功
全局镜像配置(如果有需要可以配置):
C:UsersHoscen.gradle下新建init.gradle
配置代码:
- allprojects{
- repositories {
- def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
- def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
- all { ArtifactRepository repo ->
- if(repo instanceof MavenArtifactRepository){
- def url = repo.url.toString()
- if (url.startsWith('https://repo1.maven.org/maven2')) {
- project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
- remove repo
- }
- if (url.startsWith('https://jcenter.bintray.com/')) {
- project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
- remove repo
- }
- }
- }
- maven {
- url ALIYUN_REPOSITORY_URL
- url ALIYUN_JCENTER_URL
- }
- }
- }
idea配置gradle:
下面这个问题是我用idea2016版本遇到的,后面使用idea2020版本之后没有这个问题了。
- Error:Support for clients using a tooling API version older than 3.0 was removed in Gradle 5.0. You are currently using tooling API version 2.13. You should upgrade your tooling API client to version 3.0 or later.
idea 2020版本的下载、安装、激活,请查看我的另一篇文章,地址:
https://www.hoscen.cn/blog/hao/articles/249319463961231360.html