java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 – How To Fix this Error ?

Why ?

When I was trying to compile one of my sample Xamarin Forms Android project, I got the below error …

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

1-error

Reason :

Then I looked for a solution and finally I found the reason is Android API 24 Requires Android JDK 8. But Still I had Android JDK 7 in my machine which came with Xamarin 4.2 with Visual Studio 2015.

Solution :

The solution was to download the Android JDK 8 and change the Android JDK path in Visual Studio to jdk 1.7 to jdk 1.8. It fixed the error and Finally my project built successfully.

Here Are Steps to Install the JDK 1.8 and how to fix the error..

  1. Go to Java SE Development Kit 8 Downloads and download the suitable file which is compatible with your OS. I have windows 10 x64 , So I downloaded the file for windows x64.

2-jdk-1-8

2. Then Install The java Development Kit 8..

3-jdk-installing

3. Select the path to Install the JDK 1.8 and go through the setup wizard…

4-select-destination

4. Then Close the setup when the installation has completed…

5-update-completed

5. Open the Visual Studio 2015 and Then Go to Tools-> Options – > Xamarin -> Android Settings

6-jdk-1-7-path

6. Change the Java Development Kit Location to JDK 1.8 path  instead of JDK 1.7 path

7-select-jdk-8-path

7. Click OK when the JDK 1.8 Path selected…

8-selected-jdk-8-path

8. Now Rebuild the Project and It will work fine… (Here is the built result in my project)

9-built-successfully

9. Now you can run the emulator to ensure that the project has build successfully…

(I’m using my Samsung galaxy J7 phone as the Emulator and it worked fine…)

10-emulator-successfull

The app opened in the phone successfully…

screenshot_20170210-213844

 

References…

https://forums.xamarin.com/discussion/67720/unsupported-major-minor-version-52-0

Thanks !

2 thoughts on “java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 – How To Fix this Error ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s