简体   繁体   中英

Android Studio cannot find my JDK

I have Android Studio installed on my Linux Mint 15 machine and I am trying to use it with LibGDX. In LibGDX I have created a project with intelliJ selected in the advanced creation menu. In Android Studio, when I go to Configure>Project Defaults>Project Structure, The JDK Location is blank and it says at the bottom "Please choose 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 the 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 have added the JAVA_HOME environment variable to my profile file and have even tried pasting the java executable in said "/home/myname/Android/Sdk/bin/java" folder but it still returns the same error. If anyone knows a fix please let me know! Thank you.

EDIT: My issue has been resolved! Thank you for your help.

我这样解决:在全局gradle设置中,使用本地gradle分配。

A little old but on my Windows 10 Machine I got the problem resolved after pointing to the 32Bit Version of the JDK. By default the Android Studio took the 64Bit one which didn't work for me.

So simply change the path to the 32Bit Version or install a 64Bit Version of the Android Studio if there is one, I did not check on that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM