Gradle can't user JAVA_HOME while debugging from Android Studio

被刻印的时光 ゝ 提交于 2020-01-15 05:13:14

问题


I'm trying to compile a project in android studio and it gives the

Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.

I've already red that to gather more information i should use:

gradlew compileDebug --stacktrace

from the main folder, but when i do that i get that error:

JAVA_HOME is set toan invalid directory: C:\Program Files (x86)\Java\Jre7\bin\java.exe;

Please note that i tried to use a 64 bit version of the jre too in the JAVA_HOME path.

Anyone can give me some help ?

Thanks in advance


回答1:


Change the value of environment variable JAVA_HOME to C:\Program Files (x86)\Java\Jre7\ instead of C:\Program Files (x86)\Java\Jre7\bin\java.exe

JAVA_HOME should be always pointing to the parent directory of JDK or JRE installation inside of which, we find the bin directory containing the java, javac, etc. binaries




回答2:


I might be reading too much into the error message, but shouldn't JAVA_HOME look more like C:\views\p4\library\bea-jrockit\1.6.0_29\windows-x86_64\dist?

Notice that it points to a folder called 'dist' instead of to the java.exe itself. To help you figure out the folder, 'dist' has inside of it 'bin'. So maybe try something more like C:\Program Files (x86)\Java\Jre7\?



来源:https://stackoverflow.com/questions/17047549/gradle-cant-user-java-home-while-debugging-from-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!