When a higher JDK is used for compilation it creates class file with
higher version and when a lower JDK is used to run the program it
found that higher version of class file not supported at JVM level and
results in java.lang.UnsupportedClassVersionError.
How to fix
Increase the JAVA version you are using to run your program
You can follow some tricks
Call stable version classpath 'com.android.tools.build:gradle:2.1.0' // 2.3.0
Configuring Gradle
To enable the Java 8 language features and Jack for your project, enter the following in your module-level build.gradle file:
I had got the same error and I had JDK 8 set as JAVA_HOME. It turned out that I had Android SDK Build-tools rev 25.0.2 installed. I removed this and installed 23.0.2 instead and it worked for me.
(originally was 2.2.2)
I guess this was generated by get several people working in the same project with different versions of gradle. So check your gradle version and edit this file properly.
I also got the same error message of 'Unsupported major.minor version 52.0' when running ./gradlew makeJar to create a jar library by Android Studio 2.2.3.
After moving down the version of gradle plugin in build.gradle from 2.2.2 to 2.1.3, the error message disappeared and all worked well.
classpath 'com.android.tools.build:gradle:2.1.3'
I don't know how the higer version of gradle plugin caused the error, but this did the trick for me. please let me know how this worked if you know the answer, thanks
Download latest JDK and install. Go toVS2015 Tools > Options > Xamarin and change the java to the latest JDK location
Unsupported major.minor version 52.0
How to fix
You can follow some tricks
Configuring Gradle
To enable the Java 8 language features and Jack for your project, enter the following in your module-level build.gradle file:
Courtesy goes to Java 8 Language Features
Just select "API 23: Android 6.0" from preview section .
I had got the same error and I had JDK 8 set as JAVA_HOME. It turned out that I had Android SDK Build-tools rev 25.0.2 installed. I removed this and installed 23.0.2 instead and it worked for me.
If you're seeing this error and you just upgraded to Android Studio 2.2+ you need to update your JDK in "Project Structure" options.
On OSX, this is found under
File > Project Structure > SDK
. Or from the welcome screen inConfigure > Project Defaults > Project Structure
.Select the
Use the embedded JDK (recommended)
option instead of using your own JDK.Google's docs aren't yet updated to reflect this change. See: http://tools.android.com/tech-docs/configuration/osx-jdk
Im my case I had to change the dependencies of the
build.gradle
file to:(originally was 2.2.2) I guess this was generated by get several people working in the same project with different versions of gradle. So check your gradle version and edit this file properly.
Good vibes!
I also got the same error message of 'Unsupported major.minor version 52.0' when running ./gradlew makeJar to create a jar library by Android Studio 2.2.3.
After moving down the version of gradle plugin in build.gradle from 2.2.2 to 2.1.3, the error message disappeared and all worked well. classpath 'com.android.tools.build:gradle:2.1.3'
I don't know how the higer version of gradle plugin caused the error, but this did the trick for me. please let me know how this worked if you know the answer, thanks