首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >找不到org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21

找不到org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21
EN

Stack Overflow用户
提问于 2021-11-12 05:51:43
回答 1查看 1.9K关注 0票数 0

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

代码语言:javascript
运行
复制
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"
    }
}

我没有做任何其他的改变,我怎样才能解决这个问题?我得到的错误是

代码语言:javascript
运行
复制
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 :
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-12 07:22:17

您所面临的问题正在发生,因为您没有将mavenCentral()添加到repositories {}块中。添加如下:

代码语言:javascript
运行
复制
repositories {
  mavenCentral()
  google()
}

另外,删除jcenter(),现在就不再推荐它了。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69938495

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档