国内链接google、jcenter的maven仓库,会经常失败,这样解决的问题就是使用阿里云的代理.
将gradle的配置文件做如下改动,就可以编译成功了.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
//google()
//jcenter()
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.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 {
//google()
//jcenter()
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
来源:CSDN
作者:challenge51all
链接:https://blog.csdn.net/challenge51all/article/details/104007845