android - 无法通过新项目从 jcenter 获取依赖项

标签 android android-gradle-plugin jcenter

我无法通过新项目从 jcenter 获取 kotlin pom。

我所做的只是文件->新建项目并创建了一个没有任何 Activity 的新项目。

我在尝试构建时收到以下错误:

ERROR: Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.21/kotlin-stdlib-jdk8-1.3.21.pom'. Received status code 502 from server: Bad Gateway Enable Gradle 'offline mode' and sync project

我的 build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'

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

allprojects {
    repositories {
        google()
        jcenter()

    }
}

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

如果我在网络浏览器中访问该 URL,我也无法连接。 https://jcenter.bintray.com/

这是否意味着站点暂时关闭,或者我需要在构建文件中添加什么内容?

顺便说一句,我为该项目选择了 Java,而不是设置 Kotlin,如果这很重要的话,甚至不确定它为什么要尝试获取 kotlin 的东西。

最佳答案

jcenter 当前已关闭。最后将 mavenCentral() 添加到 project build.gradle 文件中的两组存储库对我来说是一种解决方法:

buildscript {
    repositories {
        mavenCentral()
        google()
        jcenter()

...

allprojects {
    repositories {
        mavenCentral() 
        google() 
        jcenter()

...

关于android - 无法通过新项目从 jcenter 获取依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55276279/

相关文章:

android - ButterKnife - 找不到 Gradle DSL 方法 apt()

android - gradle : Could not find com. android.support :multidex:1. 0.1

android - Gradle : Could not publish configuration archives

maven - 如何将闭源库发布到jCenter?

java - 使用 mp4Parser java 库动态查找和剪切 mp4 http 流

android - buildozer 虚拟机的问题

android react-native在谷歌审批过程中避免 "Background location access not declared"

java - 序列化/反序列化 LinkedHashMap (android) java

android - AGP 7.0.0-alpha15 后如何更改版本代码

android - 无法构建 osmdroid 存储库