Ubuntu – How to set the JDK for Android Studio

androidjavajdkopenjdk

I can't compile a default new project for Android 2.1 because(?) the JDK used by Android Studio is JDK 1.7 but it should be JDK 1.6.

To change it I go to File -> Project Structure and try to find the JDK 1.6 location.

But when I select its directory and press OK I get the following error:

Please choose a valid JDK directory

Please choose a valid JDK directory

As you can see on the screenshoot I'm trying to set Java 6 OpenJDK 64-bits as the new JDK.

What can I do? Isn't Android Studio compatible with OpenJDK and should I use Oracle JDK instead?

Best Answer

I'm using OpenJDK 7 with Android Studio and it works just fine. (I don't even have Oracle JDK installed at the moment.)

On that screen that you are showing (Project Structure-->SKD Location) I have the following path for the JDK location: /usr/lib/jvm/java-1.7.0-openjdk-amd64.

Related Question