37

After Updating Android Studio from 3.0 to 3.1 My project gradle syncing failed with the following error.

Gradle sync failed: Uninitialized object exists on backward branch 70 Exception Details: Location: 
com/android/build/gradle/tasks/BuildArtifactReportTask.newArtifact(Lcom/android/build/api/artifact/BuildableArtifact;)
Lcom/android/build/gradle/tasks/BuildArtifactReportTask$BuildableArtifactData;
OneWorld
  • 17,512
  • 21
  • 86
  • 136
tech_android
  • 719
  • 1
  • 7
  • 18
  • Read this link: https://stackoverflow.com/questions/49510176/android-studio-gradle-sync-failed-could-not-head-received-status-code-5/49511911#49511911 – Pedro Massango Mar 27 '18 at 14:17

5 Answers5

76

As @tech_android already posted in this comment, to solve that problem permanently, go to Module Settings > SDK Location > Use embedded JDK.

This will remove dependency on the external Java installation by using the embedded JDK.

Remove dependency on the external JAVA installation by using the embedded JDK.

Mangesh
  • 5,491
  • 5
  • 48
  • 71
OneWorld
  • 17,512
  • 21
  • 86
  • 136
10

This is a bug of JDK old versions i guess. Go to the project structure and change your project to latest JDK like 1.80_72 or later versions.

Hopefully it will fix your problem.

0xAliHn
  • 18,390
  • 23
  • 91
  • 111
6

It's resolved my issue when I used embedded JDK(recommended) option

Do this:

Project Structure -> SDK Location -> Select "Use embedded JDK(recommended)"

immodi
  • 607
  • 1
  • 6
  • 21
5

1) Update to the latest JDK Version, in my case jdk1.8.0_162

2) In your Android Studio select File-> Project Structure -> SDK Location -> JDK Location, write the directory C:\Program Files\Java\jdk1.8.0_162

3) Restart Android Studio

Problem Solved

melhito
  • 59
  • 4
0

Android Studio: 3.5.3
gradle plugin: 3.5.3
gradle: 5.4.1
platform: Mac OS Mojave 10.14.6 (18G103)

I had done this:Project Structure -> SDK Location -> Select "Use embedded JDK(recommended)" but it still not working.

when I read this article,

you can add a property at gradle.properies:

org.gradle.java.home=(path to JDK home)

it works!

Blues
  • 93
  • 6