1

I have a problem. After update my windows 10, gradle sync failed on android studio 3.0. I use gradle 4.5. Error message:

The newly created daemon process has a different context than expected. Java home is different. Expecting: 'C:\android-studio\jre' but was: 'C:\Program Files\Java\jre1.8.0_74'. Please configure the JDK to match the expected one.

I run"studio64.exe". I try to add java.home to gradl.properties but it dosen't work. It's wierd because before update averythink was ok...

miosz
  • 143
  • 1
  • 4
  • 13

1 Answers1

0

It seems your Android studio and JAVA_HOME environment variable refers to different directories. Check if these to values are same and they should refer to jdk path not jre.

miskender
  • 7,460
  • 1
  • 19
  • 23
  • In android studio it's File -> Project Structure -> JDK location? – miosz Mar 18 '18 at 17:48
  • @miosz is it refers to your jdk installation path? – miskender Mar 18 '18 at 17:49
  • yes, there I have a path: "C:\android-studio\jre" so I have to add this path to JAVA_HOME? – miosz Mar 18 '18 at 17:51
  • @miosz If this jre is a jdk installation yes. Try it anyway(you said it was working before) Also check this https://discuss.gradle.org/t/gradle-daemon-different-context/2146 – miskender Mar 18 '18 at 17:54
  • I'm a bit confused... I add to JAVA_HOME location "C:\android-studio\jre" but it still doesn't work... :( – miosz Mar 18 '18 at 18:10
  • @miosz can you install jdk, and refer to it instead of C:\android-studio\jre in both places. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html – miskender Mar 18 '18 at 19:00