0.离线下载
    /home/user用户名/.gradle/wrapper/dists
    然后直接进入【gradle-4.4-all】》【9br9xq1tocpiv8o6njlyu5op1】文件夹
    刚才复制的压缩包复制到当前文件夹下,然后解压出来。
    grade
    1.C:\Users\用户.gradle下init.gradle(沒有此文件就新建一個)文件下增加如下代码内容

    1. allprojects{
    2. repositories {
    3. def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
    4. def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
    5. all { ArtifactRepository repo ->
    6. if(repo instanceof MavenArtifactRepository){
    7. def url = repo.url.toString()
    8. if (url.startsWith('https://repo1.maven.org/maven2')) {
    9. project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
    10. remove repo
    11. }
    12. if (url.startsWith('https://jcenter.bintray.com/')) {
    13. project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
    14. remove repo
    15. }
    16. }
    17. }
    18. maven {
    19. url ALIYUN_REPOSITORY_URL
    20. url ALIYUN_JCENTER_URL
    21. }
    22. }
    23. }

    2.android 工程根目录下的的build.gradle文件中配置国内阿里镜像库
    阿里云镜像元

    buildscript {
    ......
        repositories {
            maven { url 'http://maven.aliyun.com/repository/google' }
            maven { url 'http://maven.aliyun.com/repository/jcenter' }
            maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
            google()
            jcenter()
        }
    .....
    }
    ........
    allprojects {
        repositories {
            maven { url 'http://maven.aliyun.com/repository/google' }
            maven { url 'http://maven.aliyun.com/repository/jcenter' }
            maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
            google()
            jcenter()
        }
    }