Gradle 国内设置

Gradle 国内设置
减少依赖 Google 和 JCenter,使用国内镜像,加速已经很慢的Gradle。

buildscript {
    repositories {
        // 屏蔽默认
        // google()
        // jcenter()
        // 补充国内镜像库
        // maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'https://plugins.gradle.org/m2/' }
        maven { url 'http://maven.net.cn/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

allprojects {
    repositories {
        // 屏蔽默认
        // google()
        // jcenter()
        // 补充国内镜像库
        // maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'https://plugins.gradle.org/m2/' }
        maven { url 'http://maven.net.cn/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
    }
}