Programing

Android 스튜디오 : Gradle 동기화 실패 : '…'HEAD를 보낼 수 없습니다.

crosscheck 2020. 10. 22. 07:41
반응형

Android 스튜디오 : Gradle 동기화 실패 : '…'HEAD를 보낼 수 없습니다. 서버로부터 상태 코드 502 수신 : 잘못된 게이트웨이


내 프로젝트에서 Android Studio를 최신 버전 (3.1) 및 gradle 버전으로 업데이트 한 후 오류가 발생합니다 (링크는 항상 다릅니다).

12:54   Gradle sync started

12:56   Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/com/android/tools/analytics-library/shared/26.1.0/shared-26.1.0.jar'. Received status code 502 from server: Bad Gateway             Consult IDE log for more details (Help | Show Log) (1m 56s 602ms)

12:56   Gradle sync started

12:57   Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/org/codehaus/mojo/animal-sniffer-parent/1.14/animal-sniffer-parent-1.14.pom'. Received status code 502 from server: Bad Gateway             Consult IDE log for more details (Help | Show Log) (1m 4s 266ms)

12:58   Gradle sync started

12:59   Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/com/sun/activation/all/1.2.0/all-1.2.0.pom'. Received status code 502 from server: Bad Gateway          Consult IDE log for more details (Help | Show Log) (1m 29s 985ms)

13:01   Gradle sync started

13:02   Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/com/sun/activation/javax.activation/1.2.0/javax.activation-1.2.0.pom'. Received status code 502 from server: Bad Gateway            Consult IDE log for more details (Help | Show Log) (4s 976ms)

Android Studio 버전 :

Android Studio 3.1
Build #AI-173.4670197, built on March 22, 2018
JRE: 1.8.0_152-release-1024-b02 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

나는 이미 깨끗한 재 구축 및 업데이트를 시도하고 Android Studio 및 PC를 다시 시작했지만 성공하지 못했습니다. 어떤 아이디어?

추신 : 물론 인터넷이 있습니다. 또한 브라우저에서 링크를 열면 파일이 다운로드됩니다.


jcenter에 현재 문제가 있습니다. http://status.bintray.com/을 확인 하십시오.


Android Studio를 3.1.0으로 업데이트 한 후

방금 똑같은 문제가 발생했습니다.

 maven {   url "https://maven.google.com"  }

받는 사람 최상위 buildScript 이 같은 프로젝트 수준 Gradle을 -

 buildscript {
    repositories {
      .....
      ...
     maven {   url "https://maven.google.com"   }

참고로 프로젝트 수준 gradle 샘플가져 가십시오.

buildscript {

  repositories {
      google()
      jcenter()
      maven { url 'https://maven.fabric.io/public' }
      maven { url 'https://jitpack.io' }
      mavenCentral()
      maven { url 'https://maven.fabric.io/public' }
      maven {  url "https://maven.google.com"  }
  }
 dependencies {
     classpath 'com.android.tools.build:gradle:3.1.0'
     classpath 'io.fabric.tools:gradle:1.24.4'
   }
}

 allprojects {
   repositories {
      google()
      jcenter()      
   }
 }

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

참고 :-한 가지 더 :-

에서 gradle-wrapper.properties사용이 : -

  distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

대신4.1-all.zip.

편집 :-문제를 빨리 해결하려면 Omar의 답변 에 따라 다음을 추가해 볼 수도 있습니다 .

 maven { url "http://dl.bintray.com/riteshakya037/maven" }

와 함께

  maven { url "https://maven.google.com" }

빠른 답변에 감사드립니다!

"jcenter.bintray.com"웹 사이트에서 일시적인 네트워크 문제인 것 같습니다. "다시 시도"를 여러 번 클릭했고 결국 모든 것이 업데이트되었습니다.

또한 브라우저에서 링크를 열면 때때로 "서비스 오류"메시지가 표시됩니다. 그래서 문제는 당신 편이 아닙니다.


좋아, 나는 그것을 다음과 같이 slove한다.

당신에 build.gradle의 프로젝트 수준이 추가 :

buildscript {
    ...
repositories {
    google()
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'https://jitpack.io' }
    mavenCentral()
    maven { url "https://maven.google.com" }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.0' // Updated from 3.0 to 3.1.0

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

Note that I've updated gradle from 3.0 to 3.1.0

Next: add the same previous links to allprojects's repository body:

allprojects {
repositories {
    google()
    jcenter()
    mavenCentral()
    maven { url 'https://jitpack.io' }
    maven { url "https://maven.google.com" }
    maven { url 'https://maven.fabric.io/public' }
}

}

One more thing:

In gradle-wrapper.properties use this :

distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

After that, just sync again, and it will work.


For me after applying Santanu Sur's answer The error hapenned again but with another library I have check project's gradle and I found this line maven { url "http://dl.bintray.com/riteshakya037/maven" } in

allprojects {
    repositories {
        maven { url "http://dl.bintray.com/riteshakya037/maven" }
        maven { url "https://jitpack.io" }
        jcenter()
        google()
    }
}

I deleted it, and everything is good now


Tip:
When you get your project to build correctly the once enable offline-mode so AS don't have to connect to jcenter every gradle refresh.

enter image description here


I've just clicked Disable Gradle 'offline mode' and sync project and Android Studio downloaded all the needed files.


It's a server response error. Keep trying by pressing "Try Again" after some time. It will be ok automatically.


Uninstalling and Download & install from Developer site solved the issue for me.

참고URL : https://stackoverflow.com/questions/49510176/android-studio-gradle-sync-failed-could-not-head-received-status-code-5

반응형