Android Studio Gradle 下载缓慢的解决方法

一句话,换成国内的源,但是之前大佬分享的地址已经过时了。
我又查看了一下,阿里改了目录了……现在提供解决方法

  1. 找到项目根目录的build.gradle文件,用记事本或者其他方法打开
  2. 添加两个国内阿里的源,修改之后的文件如下(记得注掉google()jcenter(),否则会在这两个位置查找)
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.2.71'
    repositories {
//google()
        //jcenter()
maven{ url 'https://maven.aliyun.com/repository/google'}
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        //google()
        //jcenter()
maven{ url 'https://maven.aliyun.com/repository/google'}
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

你可能感兴趣的:(Android Studio Gradle 下载缓慢的解决方法)