Gradle工程错误:Gradle sync failed: Java home is different

 Gradle sync failed: Java home is different

(1)错误描述

Gradle sync failed: The newly created daemon process has a different context than expected.

It won't be possible to reconnect to this daemon. Context mismatch: 

Java home is different.

Wanted: DefaultDaemonContext[uid=null,javaHome=D:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3\jre,daemonRegistryDir=C:\Users\SAMSUNG\.gradle\daemon,pid=14504,idleTimeout=null,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]

Actual: DefaultDaemonContext[uid=e3f7107e-b6b3-4f6b-a3ae-a4bbaa04305c,javaHome=D:\Java\jdk1.8.0_121,daemonRegistryDir=C:\SAMSUNG\lihy\.gradle\daemon,pid=18556,idleTimeout=60000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]

Consult IDE log for more details (Help | Show Log)

(2)解决方法:

在gradle.properties文件中加入org.gradle.Java.home=E\:\\Software\\Android\\Java\\jdk1.8.0_92

你可能感兴趣的:(Android)