Android Studio:无法解析配置“:classpath”的所有工件

5 android gradle kotlin

我在Android Studio中创建了一个新项目,弹出错误:

A problem occurred configuring root project 'About Me'.
> 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
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

小智 5

尝试这个 :

ext.kotlin_version = "1.5.0"
repositories {
    google()
    mavenCentral()
}
dependencies {
    classpath "com.android.tools.build:gradle:4.2.0"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Run Code Online (Sandbox Code Playgroud)

看起来服务器端有一些问题只需将 kotlin 版本更改为 1.5.0 而不是 1.5.0-release-764