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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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


以上是关于Gradle工程错误:Gradle sync failed: Java home is different的主要内容,如果未能解决你的问题,请参考以下文章

Android studio更新版本后Gradle sync简直是龟速,接下来让我们快速Gradle sync

android studio 更新 Gradle错误解决方法(Gradle sync failed)

AS中加载gradle时出现Gradle sync failed: Could not find com.android.tools.build:gradle.的错误

开发错误记录5-Failed to sync Gradle project ‘HideTitleDemo’

Gradle project sync failed

Gradle sync failed: /Applications/Android Studio.app/Contents/gradle/gradle-2.14.1/lib/plugins/gradl