title: Gradle in Android Studio giving error Project sync failed
body: <p>I am new to Android Studio.I installed Android Studio-1.2.1.1 and i have jdk1.7.0_40 installed.I am facing problem with gradle build.
  For reference you can check <a href="https://issues.gradle.org/browse/GRADLE-2803" rel="nofollow noreferrer">gradle issue</a> </p>
  
  <p>I am getting following error in messages</p>
  
  <pre><code>Error:The newly created daemon process has a different context than expected.
  Java home is different.
  Expecting: 'C:\Program Files\Java\jdk1.7.0_40' but was: 'C:\Program Files\Java\jdk1.7.0_40\jre'.
  Please configure the JDK to match the expected one.
  &lt;a href="open.project.structure"&gt;Open JDK Settings&lt;/a&gt;
  </code></pre>
  
  <p>All i understood is gradle is using JRE and Android Studio is using JDK and due to that two JAVA_HOME's are different and giving errors.</p>
  
  <p>I tried downloading gradle 2.3 and changed gradle path in android studio to this file,still same problem.</p>