4.1: [项目路径]\android\build.gradle
allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://mirrors.cloud.tencent.com/nexus/repository/maven-public/'}
maven { url 'https://mirrors.huaweicloud.com/repository/maven/'}
google()
mavenCentral()
}
}
4.2: [项目路径]\android\settings.gradle
repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://mirrors.cloud.tencent.com/nexus/repository/maven-public/'}
maven { url 'https://mirrors.huaweicloud.com/repository/maven/'}
google()
mavenCentral()
gradlePluginPortal()
}
4.3: [项目路径]\android\gradle\wrapper\gradle-wrapper.properties
删除: distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
改成: distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.6.3-all.zip
4.4: gradle 配置国内镜像: C:\Users\[用户]\.gradle\init.gradle 没有init.gradle文件,可直接创建
allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://mirrors.cloud.tencent.com/nexus/repository/maven-public/'}
maven { url 'https://mirrors.huaweicloud.com/repository/maven/'}
mavenCentral()
google()
}
}