0
votes

I use Android Studio und if i run a app, Gradle cannot find JAVA_HOME

  • What went wrong: Execution failed for task ':app:compileDebugJava'. Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.

But JAVA_HOME is set:

alexader@alexander-mint ~ $ echo $JAVA_HOME

returns

/usr/lib/jvm/java-8-oracle

What do i wrong?

1
What are the contents of Your /usr/lib/jvm/java-8-oracle/ dir? - varun
Here is the filelist: bin ; javafx-src.zip ; man ; THIRDPARTYLICENSEREADME-JAVAFX.txt ; COPYRIGHT ; jre ; README.html ; THIRDPARTYLICENSEREADME.txt ; db ; lib ; release ; include ; LICENSE ; src.zip - Alexander G.
Your JAVA_HOME seems fine. Check if java compiler is working properly by executing 'javac' in terminal - varun
If i run javac in terminal, it outputs the help message from javac with all possible arguments. - Alexander G.
Everything seems fine! dont know what the error is about. Last is you can try to change the JAVA_HOME location to /usr/lib/jvm - varun

1 Answers

1
votes

Since your JAVA_HOME seems to work well, have a look at your Project Structure (Shortcut: Ctrl + Alt + Shift + S). Here you can define the location of your JDK. Sometimes this path is "wrong".