问题
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