在重新安装android和vscode之后,我遇到了kotlin和gradle的问题。我所做的更改位于build.gradle下的android文件夹的根目录中。
buildscript {
ext.kotlin_version = '1.5.21 ' //previous was 1.5.20
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2' // previous was 4.1.1
classpath 'com.google.gms:google-services:4.3.8'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
我没有做任何其他的改变,我怎样才能解决这个问题?我得到的错误是
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21 .
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.21 /kotlin-gradle-plugin-1.5.21 .pom
- https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.21 /kotlin-gradle-plugin-1.5.21 .pom
Required by:
project :
发布于 2021-11-12 07:22:17
您所面临的问题正在发生,因为您没有将mavenCentral()
添加到repositories {}
块中。添加如下:
repositories {
mavenCentral()
google()
}
另外,删除jcenter()
,现在就不再推荐它了。
https://stackoverflow.com/questions/69938495
复制相似问题