Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 2.2. Preview 1 error: "Please use JDK 8 or newer"

On trying to run Android Studio 2.2 Preview 1, it gives the following error on gradle build:

Error:Please use JDK 8 or newer.

If I try and do it from the console it says:

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\Coding\Android projects\MaterialScrollBar\app\build.gradle' line: 1

  • What went wrong: A problem occurred evaluating project ':app'. com/android/jack/api/ConfigNotSupportedException : Unsupported major.minor version 52.0

I've tried to change the JDK as it suggests from jdk 1.7 to 1.8, but each time I change the JDK location for the project to any other path than the one it currently has it resets back immediately. Even if I change it to other versions of 1.7 it won't change.

I've verified that the environmental variables all point to 1.8 and still no dice. AS 2.1 recognises the JDK as 1.8 for the same project.

like image 234
der_Fidelis Avatar asked May 19 '16 22:05

der_Fidelis


3 Answers

if you are using 3.0.1 first enable the use embedded jdk option from File-> project structure -> enable use embedded jdk

like image 61
Tamil Selvan S Avatar answered Nov 15 '22 17:11

Tamil Selvan S


Make sure you set it in the project structure

Use File -> Project Structure to set the SDK and JDK. I think you are modifying a generated file.

Also try adding this in your gradle file:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
like image 34
Cory Roy Avatar answered Nov 15 '22 17:11

Cory Roy


If you use Android Studio 2.2 Preview 2 and have same error just check "Use embedded JDK" in SDK Location. Use embedded JDK

like image 44
Episodex Avatar answered Nov 15 '22 18:11

Episodex