Android Studio 4.2 - Kotlin 版本 1.5.0 错误和无限加载项目结构中的建议 window

Android Studio 4.2 - Kotlin version 1.5.0 error and endless loading for suggestions in Project Structure window

这是什么意思?

我尝试将 ext.kotlin_version = '1.5.0' 更改为 ext.kotlin_version = '1.5.0-release-764' 但在这种情况下 gradle 项目无法使用 Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0-release-764.

构建

UPDATE ext.kotlin_version = '1.5.0' - 也不起作用,同样的错误和警告

build.gradle:

buildscript {
    ext.kotlin_version = '1.5.0'

    repositories {
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
    }
}

gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

Could not resolve all artifacts for configuration ':classpath'. Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0. Searched in the following locations: - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0/kotlin-gradle-plugin-1.5.0.pom If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.

更新 2

我必须添加 mavenCentral() 才能使其正常工作,尽管警告仍然存在但它会生成

另外一个问题,如果 4.2 版本在更新一个依赖项的版本后 window 中无限加载项目结构中的建议

试试 " :

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"

我最近在使用版本 1.5.10-release-894 时遇到了这个问题。 所以我更改为 1.5.10 现在它构建了 !

buildscript {
    ext.kotlin_version = "1.5.10"
    repositories {
        google()
        mavenCentral()
    }

我还更新了 build.gradle 版本 4.2.1

    dependencies {
        classpath "com.android.tools.build:gradle:4.2.1"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }

他们发布了新版本202-1.5.10-release-894-AS8194.7

现在它可以正常工作,没有任何警告:ext.kotlin_version = '1.5.10'

虽然第二期没看

endless loading for suggestions in Project Structure window