Java DizzyCoding

Unsupported major.minor version 52.0 in my app

Unsupported major.minor version 52.0 in my appError is an illegal operation performed by the user which results in the abnormal working of the program. By now, you’ve probably seen a few errors, either when compiling or running your code like Unsupported major.minor version 52.0 in my app. It can be frustrating, but they can also give you a lot of information about exactly how you can fix the problems in your code about java and android. In this post covers the types of errors you’ll see when programming in Java, and how to fix them. Don’t pay any attention to the number of errors. Just read the first error message and work on fixing that error.

Problem :

I’m trying to compile my Android project and I’m getting this error

[INFO] Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
[INFO]  at java.lang.ClassLoader.defineClass1(Native Method)
[INFO]  at java.lang.ClassLoader.defineClass(
[INFO]  at
[INFO]  at
[INFO]  at$100(
[INFO]  at$
[INFO]  at$
[INFO]  at Method)
[INFO]  at
[INFO]  at java.lang.ClassLoader.loadClass(
[INFO]  at sun.misc.Launcher$AppClassLoader.loadClass(
[INFO]  at java.lang.ClassLoader.loadClass(
[INFO]  at sun.launcher.LauncherHelper.checkAndLoadMain(
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------

I’ve been reading in other post that try to compile with Java 8 might cause that error but not my case, I have the following Java version:

java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)

OS: Linux Mint
(I’m not have Java 8 installed.)
Build: MAVEN

Can anyone help me with this?

Solution :

I face this problem too when making new project from android studio.

I’ve been able to resolve this by downgrading buildToolsVersion in app gradle setting:
change {module-name}/build.gradle line

buildToolsVersion “24.0.0 rc1”


buildToolsVersion “23.0.3”

In Android Studio 2.1 Go to File-> Project Structure->App -> Build Tool Version. Change it to 23.0.3

Do the method above, only when you are using java version 7 and for some reason do not want to upgrade to java 8 yet.

Hope this helps

Gradle Scripts >> build.gradle (Module app)

Change buildToolsVersion “24.0.0” to buildToolsVersion “23.0.3”

source : experience

Initially I had downgraded buildToolsVersion from 24.0.0 rc3 to 23.0.3, as specified in Rudy Kurniawan’s answer. Then I have noticed that I have jdk 7 specified in my project settings. I have changed it to jdk 8 and now build tools 24.0.0 rc3 work.

It’s also important to have compile options set to java7:

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7

I installed Android Studio alongside to Xamarin Visual Studio (was already installed). After the installation (excluded SDK, because they were already installed) I started Android Studio and it downloaded, installed and added missing SDKs (after giving the path to the SDK location). As a result I got the error message on build

java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0

As a solution I installed jdk-8u101-windows-i586.exe without JRE (because it was already installed). Before I tried the x64 version, but it disappeared … Then you have to change the Java Development Kit location.

This is done in Visual Studio by clicking Tools > Options > Xamarin > Android Settings. Here you can navigate to the correct location. In my case it was C:Program Files (x86)Javajdk1.8.0_101.

Finally, clean your project and make a new build 🙂

The problem specified:

Exception in thread “main” java.lang.UnsupportedClassVersionError:
com/android/dx/command/Main : Unsupported major.minor version 52.

is caused when is declared inside the build.gradle, buildToolsVersion 24 and we don´t have Java 8 installed that is required for this version. To solve this problem we have to change from buildToolsVersion from 24 to maximum 23:

Java 8 must be required in the future for Android Studio, so we have to start using Java 8.

I had the same problem with my IntelliJ Maven build. My “solution” was to go into the build tools and remove the build tools 24.0.0 folder. I found it in the {android-sdk-location}/build-tools/ directory. This is not a long term fix, but this should at least get your project building again. Upgrading to Java 8 as many have suggested will be better long term.

I also faced this problem when making a new project in eclipse.

  1. Open your eclipse installation directory
  2. Open the file eclipse.ini
  3. Modify




Hope this helps

What no one here is saying is that with Build Tools 24.0.0, Java 8 is required and most people have either 1.6 or 1.7.

So yeah, setting the build tool to 23.x.x would ‘solve’ the problem but the root cause is the Java version on your system.

On the long term, you might want to upgrade your dev environment to use JDK8 to make use the new language enhancements and the jack compiler.

52 is the code for JDK 8. You can see that here: So Gradle is expecting you to have JDK 8 as the default Java version on your machine. Newest versions of Gradle for Android won’t work with Java 7.

The solution is simple: make Java 8 the default jdk version on your machine.

I am on Android Studio 2.0 and facing the same problem.
The solution provided by Rudy Kurniawan sorted out this issue. The affected file can be located by:

“Project” -> “Android” -> “Gradle Scripts” -> “build.gradle(Module:app)”

The “Project” pane is default on the left. To find it, inspect the name of the side tabs, click it, then use the top pull down box to get to “Android“. Expand the tree in the pane to find the target file. Double-click it to edit.

Thanks everyone for solution.

I could solve my same problem using below solution.

In my project, I added jar which were created in Java8. And my project was referring to JRE 7. When i changed project JRE to 8. My problem solved.

Steps: In eclipse, right click on project name in project explorer > build path > Libraries > click on jre version > click edit > installed JRE > add > standerd VM > select JRE home click-path (path should be localePathjavajdk1.8.0_25jre) > provide name > save > select same JRE for project > finish > ok Refresh/build project once > try to run your java file. it should work.

Get this error message on the travis build server?

I fixed my travis build with
buildToolsVersion “24.0.2” using this

# travis build 
language: android

  - oraclejdk8

    - tools
    - build-tools-24.0.2
    - android-23

    - add-on
    - extra

  - jdk_switcher use oraclejdk8
  - ./gradlew assemble

In my case the default jdk was 1.7 then I changed it to 1.8 by browsing to the exact folder where the updated jdk is found in.

I had the same problem and tried to change the version, sometimes is for the version of Android Studio in Project> Gradle Scripts> build.gradle(Module:app) you can change the version. For example:

android {
    compileSdkVersion **23**
    buildToolsVersion **"23.0.3"**

    defaultConfig {
        applicationId ""
        minSdkVersion **19**
        targetSdkVersion **23**
        versionCode **1**
        versionName **"1.0"**

From this question.

You can try to change your compiler level back to 1.7 in the IDE you’re using.

  • If you’re on Eclipse, go to Windows —> Prefences then select Java and expand it then select Compiler and change the compliance level to 1.7.
  • If you’re on Android Studio, you can add this to your build.gradle

    android {
        compileSdkVersion 19
        buildToolsVersion "19.0.0"
        defaultConfig {
            minSdkVersion 7
            targetSdkVersion 19
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7

If this doesn’t help, try checking other’s answer in the link mentioned above and let us know what helped you.

Your Android build tools are not properly installed. Try installing some other version of build tools and give that version in the gradle file.
or you can go to this directory


and see which build tools is installed. Try changing the build tool version in the gradle file and compile the app to see if it is working.

i had 22.0.1,23.0.02 and 24.0.0 versions of build tools and only the old 22.0.1 version worked.

source: i tried it myself and it worked for me.

This problem stems from the fact that your build tool version and JDK won’t work together. I was using JDK version 7 with build tool 24.0.1. Of course lowering build tool version may fix the problem but it is not a real fix, as upgrading your build tools in future will break it again.

You should make sure build tool version and JDK work together. I upgraded my build tool to latest (24.0.1) and installed jdk8. Make sure to set your JAVA_HOME to latest and then try clean build.

Got the same issue outside of Android Studio, when trying to build for Cordova using the sdk from command line (cordova build android).

The solution provided by Rudy works in this case too. You just don’t downgrade the version of Build Tools from Android Studio but you do it using the android sdk manager ui.

I just encountered this problem.

Reverting from the “Preview Channel” versions of the SDK tools and build tools to the latest stable version fixed it.

Changing to fixed it for me.

My Android Studio version is 2.1.2, perhaps that’s why

The Simplest solution is you have to update your JDK to latest, version . Because Cordova supports only latest JDK .

1. First of all you have to update your Android SDK. Then,

2. If you are not able to update through your terminal , Got to your Software center of Linux destro and search the Latest (which one you want to install) and install that one .

Then again run Cordova build .

It will solve the problem .

In ,my case it worked.

You need to go into your SDK installation directory, and make sure that the /build-tools sub-directory matches the buildToolsVersion in your app’s build.gradle file:

Check that you have the latest version of the SDK installed in either C:Program FilesJava or C:Program Files (x86)Java

Then go to VS2015 and follow the path tools – options – Xamarin – Android settings and in the section JDK location select change and go to look for the version you have either x64 or x32.

I am on cordova, here’s what I’ve done:

– rename your android project, so that there’s space for new one
– update JAVA Development Kit to 1.8 (latest one in time of writing this)
– run cordova platform add android

Should work without problems now. Your app hash will change, so if you are using it f.e. for facbeook login, you will need to update it

I’d had this issue for too long (SO etc hadn’t helped) and only just solved it (using sdk 25).

-The file proguard.dir var was not applying with ant; I’d specified 5.3.2, but a command line call and signed export build (eclipse) was using 4.7, from the sdk dir(only 5+ supports java 8)

My solution was to replace the proguard jars (android-sdk/tools/proguard/libs directory) in the sdk with a current (5+) version of proguard.

unsupported-major-minor-version error can be because of unsupported JDK version. Update JDK, Go to Module Settings and change the JDK path to the new one. In most of the cases, it fixes the error.

I had two versions of java jdk installed. Once I pointed to right version of java jdk in File->Project Structure -> SDK Location to the latest version which I had in JAVA_HOME environment variable, the issue went away.

Exit mobile version