【问题标题】:Android Studio 4.2 Kotlin Plugin IssueAndroid Studio 4.2 Kotlin 插件问题
【发布时间】:2021-07-27 19:10:42
【问题描述】:

由于以下错误,无法使用 Android Studio 4.2 构建新项目:

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

当我将 Kotlin 插件版本从 ext.kotlin_version = "1.5.0-release-764" 更改为 ext.kotlin_version = "1.5.0" 时,应用构建成功但出现以下警告:

Kotlin version that is used for building with Gradle (1.5.0) differs from the one bundled into the IDE plugin (1.5.0-release-764) 

【问题讨论】:

  • 但是我想用最新的Kotlin版本
  • Kotlin 1.5 还没有作为稳定版本发布,Android Studio Canary 应该使用 Kotlin 1.5 而不是最新的稳定版本
  • @Wang 谁说不稳定?您是从哪里获得这些信息的?
  • 我认为这是新版本的错误。每当我收到此警告时,更新版本都会使警告消失,并且我处于最新的稳定版本。这似乎在新版本中是不可能的,除非缺少一些 gradle 设置,阻止它找到捆绑版本。

标签: android android-studio kotlin


【解决方案1】:

更改自

buildscript {
ext.kotlin_version = "1.5.0-release-764"
......}

更改为

buildscript {
ext.kotlin_version = "1.5.0"
....}

更改 Kotlin 版本问题将被清除。

【讨论】:

  • 我已经在问题中提到过,但是警告呢!?
【解决方案2】:

这是一个已知的错误:

https://youtrack.jetbrains.com/issue/KTIJ-11590

“问题将在 1.5.10 更新中修复”

【讨论】:

    【解决方案3】:

    我转到 build.gradle 文件并将 ext.kotlin_version = "1.5.0" 更改为 ext.kotlin_version = "1.4.32",因为这是成功构建的旧项目的版本。

    【讨论】:

    • 再次,我想使用 Kotlin 的最新稳定版本 1.5.0 另外,如果我使用此 1.4.32 警告仍然存在。
    • 好吧,显然 1.4.32 是最新的稳定版本,lol 1.5.0 似乎无法正常工作
    【解决方案4】:

    我在 Android Studio 4.2.1 中使用与 IDE 捆绑的相同版本的 kotlin-gradle-plugin,即 1.5.10,对我来说,在我的防病毒软件中禁用“阻止与不受信任的服务器的连接”修复了错误。

    【讨论】:

      【解决方案5】:

      根据 Android Studio 的消息,Kotlin 的最新稳定版本是1.5.0-release-764。如果你想(或者在这种情况下我想每个人都需要)使用版本1.5.0

      1. 转到菜单中的Tools

      2. 转到Kotlin

      3. 选择Configure Kotlin Plugin Updates

      4. 在下拉列表中,选择 1.5.x 的抢先体验预览版,然后点击确定。

      Gradle 同步现在将使用 Kotlin 1.5.0 配置 Studio。

      【讨论】:

      • 这不能修复警告
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多