微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决Android Studio 4.2 - Kotlin 1.5.0 版错误和无限加载项目结构窗口中的建议

这是什么意思?

enter image description here

enter image description here

我尝试将 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

无法解析配置“:classpath”的所有工件。 找不到 org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0。 在以下位置搜索: - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0/kotlin-gradle-plugin-1.5.0.pom 如果您尝试检索的工件可以在存储库中找到,但没有“Maven POM”格式的元数据,您需要 调整存储库声明的 'MetadataSources { ... }'。

更新 2

我必须添加 mavenCentral() 才能使其工作,虽然警告仍然存在,但它已构建

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

enter image description here

解决方法

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

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

虽然我没有检查第二个问题

在项目结构窗口中无限加载建议

,

我最近在使用版本 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"
    }
,

尝试使用“:

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"

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。