昨天笔记本重装了系统,今天下载安装了最新的版本:Android Studio 4.2,然后创建一个新项目后就出现了异常,如下:
A problem occurred configuring root project 'HelloWorld'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0-release-764.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
在StackOverflow上找到了答案,把项目下的build.gradle中的kotlin版本改一下即可,原来的kotlin版本如下:
buildscript {
ext.kotlin_version = "1.5.0-release-764"
。。。
}
改为如下即可:
buildscript {
ext.kotlin_version = "1.5.0"
。。。
}
此时,会提示你1.5.0版本与IDE捆绑的1.5.0-release-764版本不同(如下图),不用管它,这个版本就是没法使用的,Google公司是真粗心大意啊,搞一个不能用的版本放到这真是搞笑,在考验大家解决问题的能力呢!