Android Studio gradle镜像添加

build.grale

1.添加阿里镜像
2.将google()和jcenter()注释掉

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        maven {
            url 'https://maven.aliyun.com/repository/jcenter'
        }
        maven {
            url 'https://maven.aliyun.com/repository/google'
        }

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

        //google()
        //jcenter()
        
    }
}

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

grale.properties

将镜像部分注释掉

重新构建gradle

点击图中按钮即可
在这里插入图片描述

你可能感兴趣的:(环境搭建)