打开Android Studio中根项目下的build.gradle
文件,修改其中的代码如下:
其中需要修改的部分为buildscript
下的repositories
部分,与allprojects
下的repositories
部分。AS使用的默认仓库国内访问速度较慢,所以更改为阿里云的仓库源来提升下载速度。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.71'
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url "https://jitpack.io" }
google()
}
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 'http://maven.aliyun.com/nexus/content/groups/public/' }
google()
// jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Android视图下文件位置如下:

Project视图下文件位置如下:

网友评论