新手android studio换源
环境:android-studio4.1.1,win10
修改项目的build.gradle,看清楚,只改下图选中的那个build.gradle
这是修改后build.gradle中的内容(上面图片中右侧打开的文件内容就是已修改过的)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
修改后重新启动android-studio,点击sync Project with Gradle Files即可,如下图
(注意不同版本可能这个图标有差异)