5

An Android project, It was good with the older version of Android Studio. But after I updated the IDE version, An exception will occured when I build the project whith gradle.

Here is the problem:

Error:Execution failed for task ':jellyrefresh:compileReleaseJava'.

When running gradle with java 5, 6 or 7, you must set the path to jdk8, either with property retrolambda.jdk or environment variable JAVA8_HOME

The thing is, my environment is Windows XP(I don't want to update), So I cannot install Java 8, so no need to tell me to do that. But I still want to use the Android Studio's latest version.

So what's the most resonable solution to this exception?

Waylan Punch
  • 239
  • 4
  • 17
  • java 7 works with latest android studio , can u mention the jdk path in android project properties? – KOTIOS Sep 07 '15 at 05:34
  • I think [this](http://stackoverflow.com/questions/20965564/installing-jdk8-on-windows-xp-advapi32-dll-error) would be your solution. if you couldn't use any other jdk with ADT. – Bilal Haider Sep 07 '15 at 05:39
  • I'm truely using Java7, And I already configured the jdk path in android project peoperties – Waylan Punch Sep 07 '15 at 06:05

2 Answers2

17

Go to File -> Project Structure -> SDK Location -> JDK Location and change the path to Java 8 Home, then Rebuild project.

enter image description here

The snapshot was taken from Mac. However, it should work for others too.

tausiq
  • 937
  • 1
  • 13
  • 23
  • Thanks. In a project retrolambda is used, but after downloading Java 8 setting JAVA8_HOME hasn't helped. Your advise has helped. – CoolMind May 12 '16 at 08:24
0

You can open build.gradle to take a look, maybe you used retrolambda to compile javacode, which needs java8.

kimixuchen
  • 155
  • 1
  • 9