【问题标题】:Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21找不到 org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21
【发布时间】:2021-12-24 12:58:52
【问题描述】:

重新安装 android studio 和 vscode 后,我遇到了 kotlin 和 gradle 的问题。 我所做的更改位于 build.gradle 下的 android 文件夹的根目录中。

buildscript {
    ext.kotlin_version = '1.5.21 ' //previous was 1.5.20
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.2' // previous was 4.1.1
        classpath 'com.google.gms:google-services:4.3.8'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

我没有进行任何其他更改,我该如何解决这个问题?我得到的错误是

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21 .
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.21 /kotlin-gradle-plugin-1.5.21 .pom
       - https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.21 /kotlin-gradle-plugin-1.5.21 .pom
     Required by:
         project :


【问题讨论】:

    标签: flutter kotlin visual-studio-code


    【解决方案1】:

    您面临的问题正在发生,因为您尚未将 mavenCentral() 添加到您的 repositories {} 块中。像这样添加它:

    repositories {
      mavenCentral()
      google()
    }
    

    另外,删除jcenter(),它现在已被弃用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-30
      • 2021-01-24
      • 1970-01-01
      • 1970-01-01
      • 2022-07-27
      • 2022-12-16
      相关资源
      最近更新 更多