一, gradle

1, 目标文件:gradle-wrapper.properties

#Fri Oct 27 10:18:28 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

1.1,修改distributionUrl字段

distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-6.7.1-bin.zip


2,目标文件: build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.2'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

2.1, 替换google() 和 jcenter()

// 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/google"}  //替代google()
        maven {url "https://maven.aliyun.com/repository/public"}  //替代 jcenter() , mavenCentral()
        // maven {url "https://maven.aliyun.com/nexus/content/groups/public/"}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.2'


        // 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/google"}  //替代google()
        maven {url "https://maven.aliyun.com/repository/public"}  //替代 jcenter() , mavenCentral()
        // maven {url "https://maven.aliyun.com/nexus/content/groups/public/"}
        flatDir {
            dirs 'libs'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}