Android Studio cannot find my JDK

I have Android Studio installed on my Linux Mint 15 and am trying to use it with LibGDX. In LibGDX, I created a project with intelliJ selected in the advanced build menu. In Android Studio, when I go to Configure> Project Defaults> Project Structure, JDK location is empty and it says at the bottom “Please select a valid JDK directory.” I have OpenJDK installed, and when I run java -version

in a terminal, it returns:

"java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)"

      

When I type javac -version

in a terminal that returns:

"javac 1.7.0_80"

      

When I open a project I created in LibGDX in Android Studio, it says at the bottom:

"Error: The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: /home/myname/Android/Sdk/bin/java"

      

I added the JAVA_HOME environment variable to my profile file and even tried to insert the java executable in the specified folder "/home/myname/Android/Sdk/bin/java"

, but it still returns the same error. If anyone knows a fix, please let me know! Thank.

EDIT: Solved my problem! Thank you for your help.

+3


source to share


2 answers


I resolve it like this: in the gradle global setting, use the local gradle distribution.



0


source


A bit old, but on my Windows 10 machine, I solved the problem by pointing to the 32-bit version of the JDK. By default, Android Studio took the 64 bit version which didn't work for me.



So just change path to 32bit version or install 64bit version of Android Studio if there is one, I haven't tested that.

0


source







All Articles