闲来无事,想学习一下Kotlin,建个项目想写两行代码,上来就报这个错误,上网查了一圈,找到解决的方案。记录下来。
在项目的build.gradle里加入如下代码,这里注意啊,不是在app的build.gradle里,是项目根目录下的。
buildscript {
ext.kotlin_version = '1.2.61'
repositories {
google()
//下面这个就是,一定要加在jcenter。取阿里镜像仓库地址
maven{ url'http://maven.aliyun.com/nexus/content/groups/public/'}
jcenter()
}
}
另一个地方是下面的
allprojects {
repositories {
mavenCentral()
google()
//下面这个就是,一定要加在jcenter。取阿里镜像仓库地址
maven{ url'http://maven.aliyun.com/nexus/content/groups/public/'}
jcenter()
}
}