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的主要内容,如果未能解决你的问题,请参考以下文章
GroovyIntelliJ IDEA 中创建 Gradle 工程 ( Gradle 工程目录文件分析 )
Android Gradle 插件Gradle 构建机制 ① ( 空白工程 Gradle 构建文件 | IntelliJ IDEA 工程构建文件 | Android Studio 工程构建文件 )
android开发里跳过的坑-AS导入NDK工程提示错误 No such property: sdkHandler for class: com.android.build.gradle.Librar