Unable to get dependencies from jcenter with a new

2020-01-28 07:11发布

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

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
}

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?

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.

10条回答
啃猪蹄的小仙女
2楼-- · 2020-01-28 07:50

While mostly meant as a temporary, change-back-again-when-jcenter-is-working solution, this can be fixed by downgrading the gradle plugin version to 3.3.1 in the project's gradle file:

classpath 'com.android.tools.build:gradle:3.3.1'
查看更多
兄弟一词,经得起流年.
3楼-- · 2020-01-28 07:51

Actually android studio already had the solution for you :

Syncing only active variant You can disable this experimental feature from File → Settings → Experimental → Gradle → Only sync the active variant

查看更多
倾城 Initia
4楼-- · 2020-01-28 07:52

replace jcenter() with mavenCentral() because jcenter is not available now

查看更多
Viruses.
5楼-- · 2020-01-28 07:53

It's 3 days later and i was still getting random 502 errors from bintray, for links that seemed perfectly valid. Manually checking with browser / curl the pom files were there.

What eventually helped get around, was slowing gradle down by not letting it hit the links all at once. In my case, cordova/ionic project, so

ionic cordova run android -- -- --gradleArg=--max-workers=1

Passing --no-parallel should work as well

查看更多
Evening l夕情丶
6楼-- · 2020-01-28 07:55

There is a problem in Downloads section with Partial Outage in jfrog bintray (https://status.bintray.com/incidents/2wvx6d5f807c):

Intermittent download issues in Bintray

You can see the current status in https://status.bintray.com/


Update Status from jfrog Bintray:

Update - There are still intermittent download issues in Oregon region (north America). We are still working on identifying the root cause. 
Mar 21, 10:02 UTC
查看更多
我想做一个坏孩纸
7楼-- · 2020-01-28 08:04

I have same issue, and I tried aliyun maven in this issue's answer,

jcenter 502 bad gateway after gradle refresh

and it works. So I temporary use this for building app.

查看更多
登录 后发表回答