buildscript { repositories { maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } //gradle 国内镜像仓 maven { url 'https://maven.aliyun.com/repository/google' } //google 国内镜像仓 maven { url 'https://maven.aliyun.com/repository/jcenter' } //jcenter 国内镜像仓 google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:4.0.1' } } allprojects { repositories { maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } //gradle 国内镜像仓 maven { url 'https://maven.aliyun.com/repository/google' } //google 国内镜像仓 maven { url 'https://maven.aliyun.com/repository/jcenter' } //jcenter 国内镜像仓 google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }
最后附上阿里云镜像仓地址:https://maven.aliyun.com/mvn/guide
来自:Android Studio Gradle 下载慢问题、一直 Gradle: Build..问题、依赖库下载问题等各种gradle 问题 统一解决办法_OneN的博客-CSDN博客