android studio配置阿里仓库gardle

学了一周的安卓,有时候下载依赖很慢,然后上网上找教程自己配置了阿里云的maven仓库,网上很多教程,但是android studio换一个版本工程文件就不一样,可能我是新手吧,我的配置过程:

androidstudio版本2021.1.1

第一步:切换成android视图

第二步找到strings.gradle文件打开:

如图复制以下代码进相应的位置


        maven {url 'https://maven.aliyun.com/repository/public/'}
        maven {url  'https://maven.aliyun.com/repository/central'}
        maven {url 'https://maven.aliyun.com/repository/public/'}
        maven {url 'https://maven.aliyun.com/repository/google'}
        maven {url 'https://maven.aliyun.com/repository/gradle-plugin'}

自用

pluginManagement {
    repositories {


        maven {url 'https://maven.aliyun.com/repository/public/'}
        maven {url  'https://maven.aliyun.com/repository/central'}
        maven {url 'https://maven.aliyun.com/repository/public/'}
        maven {url 'https://maven.aliyun.com/repository/google'}
        maven {url 'https://maven.aliyun.com/repository/gradle-plugin'}

//        gradlePluginPortal()
//        google()
//        mavenCentral()
        mavenLocal()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
//        google()
        maven {url 'https://maven.aliyun.com/repository/public/'}
        maven {url  'https://maven.aliyun.com/repository/central'}
        maven {url 'https://maven.aliyun.com/repository/public/'}
        maven {url 'https://maven.aliyun.com/repository/google'}
        maven {url 'https://maven.aliyun.com/repository/gradle-plugin'}
        mavenLocal()
        mavenCentral()
    }
}
rootProject.name = "WeiXin"
include ':app'


版权声明:本文为laolitou2原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。