Android Studio 项目gradle构建 仓库切换国内阿里源。

阿里源地址:https://maven.aliyun.com/mvn/view

在项目的build.grable里修改

buildscript {
    ext.kotlin_version = '1.3.72'
    repositories {
        //对应google()
        maven {url 'https://maven.aliyun.com/repository/google'}
        //对应jcenter()
        maven {url 'https://maven.aliyun.com/repository/jcenter'}
        //公共库
        maven {url 'https://maven.aliyun.com/repository/public'}

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        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 {
        maven {url 'https://maven.aliyun.com/repository/google'}
        maven {url 'https://maven.aliyun.com/repository/jcenter'}
        maven {url 'https://maven.aliyun.com/repository/public'}
    }
}

完毕,之后sync now 一下,一下不行,就两下,以此类推。。。

 

你可能感兴趣的:(Android,maven,阿里云,gradle)