java – What version of JDK (language level) is required for Android Studio?

Clarification of the answer – Android Studio supports JDK8

Below is an answer to the question “What version of Java does Android support?” Which is different from “What version of Java can I use to run Android Studio?” Which I believe is what was actually asked. For those looking to answer the second question, you may find sando = Android Studio with Java 1.7 useful.

Also: see http://developer.Android.com/sdk/index.html#latest for Android Studio. JDK8 is actually a requirement for PC and Linux (starting from 14/05/16).


Java 8 Update (3/19/14)

Because I suppose this question will start soon with yesterday’s version: as of now, there is no set date for when Android will support Java 8.

Here is a discussion on / androiddev – http://www.reddit.com/r/androiddev/comments/22mh0r/does_Android_have_any_plans_for_Java_8/

If you really want lambda support, you can check out Retrolambda – https://github.com/evant/gradle-retrolambda . I’ve never used it, but it looks promising enough.

Another update: Android added Java 7 support

Android now supports Java 7 (minus the resource test feature). You can read more about Java 7 functions here: https: //stackoverflow.com/a/13550632/413254 . If you are using gradle, you can add the following in your build.gradle:

Android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

Previous answer

I am using Java 7 with Android Studio with no problems (OS X – 10.8.4). You need to make sure you drop the project language level up to 6.0. See the screenshot below.

enter image description here

What has been said below also makes sense. If they are suggesting JDK 6, it makes sense to just go with JDK 6. Either way it will be fine.

enter image description here


Update: see this OS post – https://stackoverflow.com/a/9567402/413254

Leave a comment