Android Studio 中的 Gradle 出现错误项目同步失败 [英] Gradle in Android Studio giving error Project sync failed

查看:28
本文介绍了Android Studio 中的 Gradle 出现错误项目同步失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Android Studio 的新手.我安装了 Android Studio-1.2.1.1 并安装了 jdk1.7.0_40.我遇到了 gradle 构建问题.作为参考,您可以查看 gradle issue

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 gradle issue

我在消息中收到以下错误

I am getting following error in messages

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.
<a href="open.project.structure">Open JDK Settings</a>

我所了解的是 gradle 使用的是 JRE,而 Android Studio 使用的是 JDK,并且由于两个 JAVA_HOME 不同并且给出了错误.

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.

我尝试下载 gradle 2.3 并将 android studio 中的 gradle 路径更改为此文件,仍然存在同样的问题.

I tried downloading gradle 2.3 and changed gradle path in android studio to this file,still same problem.

推荐答案

我通过卸载所有 jdk 安装解决了这个问题 &更新然后只重新安装一个 jdk 并确保其 env.变量

I fixed this issue by uninstalling all the jdk installation & updates then reinstall only one jdk and assure its env. variables

我没有解决方案,但我遇到了同样的问题它发生在 android studio 从 java_home/jre 打开时,所有接下来将分叉的 JVM 都来自此路径,而您的系统变量告诉 Gradle 从 JAVA_HOME 获取他的 java.exe

I do not have a solution but I have the same problem it happens as the android studio opens from java_home/jre thence all JVMs that will fork next will come from this path, while your system varible tells Gradle to get his java.exe from JAVA_HOME

我试图让 gradle 从 jre 读取,但它也失败了我试图让 android studio 从 java_home/bin 打开,但它也失败了

I tried to make gradle read from jre but it falied also i tried to make android studio open from java_home/bin but it falid also

这篇关于Android Studio 中的 Gradle 出现错误项目同步失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆