Android Studio Gradle 下载慢问题、一直 Gradle: Build..问题、依赖库下载问题等各种gradle 问题 统一解决办法

根 build.gradle 设置如下:

主要设置:

        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 国内镜像仓
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,android,studio,gradle)