new工程的时候遇到 gradle project sync failed.
build 显示 Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0-release-764.
A problem occurred configuring root project 'My Application'.
> 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
测试后发现不是gradle的问题,复制pom的URL到浏览器发现无法打开网页,换maven源也无法解决
应该是kotlin版本号有问题,正常的版本号不会带后缀。
解决办法:
打开build.gradle文件,找到kotlin的版本号
ext.kotlin_version = "1.5.0-release-764"
删除后缀,修改为1.5.0
ext.kotlin_version = "1.5.0"
点击 try again
搞定。