android studio: 让项目通过阿里云 maven jcenter 下载依赖资源

打开项目根目录下的 build.gradle(Project:项目名称一级的gradle),如下所示添加阿里 maven 库地址:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
 
buildscript {
    repositories {
 
        // 添加阿里云 maven 地址         
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
 
        // jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
 
allprojects {
    repositories {
 
        // 添加阿里云 maven 地址         
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
 
        // jcenter()
        google()
    }
}
 
task clean(type: Delete) {
    delete rootProject.buildDir
}
原文地址:https://www.cnblogs.com/yongdaimi/p/11075347.html