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

Unable to get dependencies from jcenter with a new project(无法通过新项目从 jcenter 获取依赖项)
本文介绍了无法通过新项目从 jcenter 获取依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm unable to get kotlin pom from jcenter with a new project.

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

All I have done is gone File->New Project and created a new project with no activity.

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

I'm getting the following error when it tries to build:

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

My 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/

If I go in my web browser to that URL I can't connect either. https://jcenter.bintray.com/

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

Does this mean the site is temporarily down or is there something I need to add to my build files?

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

BTW I selected Java for the project and not Kotlin on setup if that matters so not even sure why it's trying to get kotlin stuff.

推荐答案

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

jcenter is currently down. In the end adding mavenCentral() to both sets of repositories in the project build.gradle file worked as a workaround for me:

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

...

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

...

这篇关于无法通过新项目从 jcenter 获取依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)