Xamarin Visual Studio - Unsupported major.minor ve

2020-02-11 04:00发布

问题:

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.

回答1:

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/



回答2:

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"


回答3:

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.



回答4:

It worked also for me ONLY changing the registry entry