Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Visual Studio - Unsupported major.minor version 52.0

I am attempting to run a Hello World example from the following tutorial: https://mva.microsoft.com/en-US/training-courses/xamarin-for-absolute-beginners-16182

I am receiving the following error:

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

I have tried many combinations of JRE/JDK versions. I am uninstalled them, reinstalled them. I have tried JDK 7 and JDK 8. I keep getting this same exact no matter what combination.

like image 493
ollama Avatar asked Sep 11 '16 00:09

ollama


3 Answers

You can follow this blog to resolve it https://agilehobo.wordpress.com/2016/08/24/2-ways-to-resolve-unsupported-major-minor-version-52-0-when-building-xamarin-android-app/

like image 144
Agile Hobo Avatar answered Nov 12 '22 04:11

Agile Hobo


The solution not involving using Visual Studio IDE (i.e. build servers) is to import the following key to the registry after installing JDK version 1.8.0_101:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Novell\Mono for Android]
"JavaSdkDirectory"="C:\\Program Files (x86)\\Java\\jdk1.8.0_101"

Don't forget to clean/update sdks.cache files in obj[Release|Debug] directories to reference the correct version of jdk.

For the reference here is a complete list of paths used by Mono for Android:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Novell\Mono for Android]
"AndroidNdkDirectory"="C:\\ProgramData\\Microsoft\\AndroidNDK\\android-ndk-r11c"
"AndroidSdkDirectory"="C:\\Program Files (x86)\\Android\\android-sdk"
"JavaSdkDirectory"="C:\\Program Files (x86)\\Java\\jdk1.8.0_101"
like image 25
too Avatar answered Nov 12 '22 03:11

too


I had a similar issue when Xamarin.Android project was moved from Xamarin Studio (Mac) to Visual Studio 2015 (Windows 10).

I resolved this issue after JDK 1.8.0_121 (for Widows x64) installation.

like image 1
Vadzim Papko Avatar answered Nov 12 '22 02:11

Vadzim Papko