当前位置: 首页 > 知识库问答 >
问题:

从jcenter迁移到mavenCentral时,找不到com.android.tools.build:gradle:4.1.0

章光华
2023-03-14

Jfrog将关闭jcenter,这意味着我们不能在build.gradle文件中使用jcenter来下载所需的库,正如我在不同的网站和android文档中看到的,我们可以使用mavenCentral()来代替jcenter,但是当它被替换为jcenter并重建项目时,我得到以下错误,这意味着com.android.tools.build:gradle:4.1.0project level build.gradle文件在mavenCentral()Google()存储库中不存在。

// Top-level build file where you can add configuration options common to all sub-projects/modules.
  buildscript {
    repositories {
      google()
      mavenCentral()
    }
  dependencies {
       classpath "com.android.tools.build:gradle:4.1.0"

       // NOTE: Do not place your application dependencies here; they belong
       // in the individual module build.gradle files
  }
}

allprojects {
  repositories {
     google()
     mavenCentral()
  }
}

  task clean(type: Delete) {
    delete rootProject.buildDir
 }

共有1个答案

丌官翰采
2023-03-14

我在使用Jcenter时也遇到了这个问题,检查您的vpn并更改vpn的连接类型。

 类似资料:
  • 您可能已经知道,JFrog宣布Bintray、JCenter、GoCenter和ChartCenter将于今年5月1日关闭。由于JCenter作为Android项目中的主要repo广泛用于各种依赖项,因此应该使用替代repo,我使用了mavenCentral因为它是最流行和被广泛接受的。 它按预期工作,但我只想从JCenter下载realm和其他缺少的东西,直到它完全迁移。然后看起来是这样的: 然

  • 我正在尝试将gradle从1.3.1更新到3.5,因为我的一些依赖项需要3.3或更高版本。 我见过类似的问题,但都没有帮助。 build.gradle: gradle-wrapper.properties: 但是,当我尝试做任何事情(构建、清理等)时,我还是得到了这样的结果:

  • 找不到com.android.tools.build:Gradle:4.0.0. https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.0/gradle-4.0.0.pom

  • null Build.Gradle(项目): 我刚刚从android Studio2.3.3迁移到4.0.1。 我的问题是什么????如果你需要更多信息就告诉我。 感谢您的回答:)

  • 我正在构建一个react原生应用程序,并使用库。 在我的Android/build.gradle中,我在buildScript中有以下内容: 这是否意味着我必须降级我的gradle版本?