Dileep Dileep - 1 year ago 162
Android Question

Setting default JDK version for android studio windows

I have searched and could not find a solution for this problem.

Error:Buildtools 24.0.2 requires Java 1.8 or above. Current JDK version is 1.7.


My JAVA_HOME variable in path variable is pointing to C:\Program Files\Java\jdk1.8.0_101

I don't know what I am missing and I couldn't find any settings in android studio to change the JDK path.

Please help me out

Answer Source

Make sure that you have proper location and version of JDK

Go to File -> Project Structure. You would see this window:

enter image description here

You can also add compileOptions in your app/build.gradle file:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}