Skip to content

Android Studio 配置 Gradle

创建文件 ~/.gradle/init.gradle

allprojects {
    buildscript {
        repositories {
            maven {name 'public'; url 'https://maven.aliyun.com/repository/public/'}
            maven {name 'google'; url 'https://maven.aliyun.com/repository/google/'}
            maven {name 'gradle_plugin'; url 'https://maven.aliyun.com/repository/gradle-plugin/'}
            maven {name 'central'; url 'https://maven.aliyun.com/repository/central/'}
            mavenLocal()
            mavenCentral()
        }
    }

    repositories {
        maven {name 'public'; url 'https://maven.aliyun.com/repository/public/'}
        maven {name 'google'; url 'https://maven.aliyun.com/repository/google/'}
        maven {name 'gradle_plugin'; url 'https://maven.aliyun.com/repository/gradle-plugin/'}
        maven {name 'central'; url 'https://maven.aliyun.com/repository/central/'}
        mavenLocal()
        mavenCentral()
    }

    println "${it.name}: Aliyun maven mirror injected"
}