Java Lang Unsupportedclassversion Error in Xamarin Studio

java Lang UnsupportedClassVersion Error in Xamarin Studio

The version 52.0 here is referring to the specific release of the JDK, which in this case relates to JDK 8.

Xamarin.Android 7.0 requires
JDK 1.8
to use the Android Nougat (API 24) APIs. You can continue to use earlier
versions of the JDK if targeting earlier Android API levels:

  • JDK 1.8 - up to API 24+

  • JDK 1.7 - up to API 23

  • JDK 1.6 - up to API 20

Additionally, a 64-bit version of the JDK is required to use custom controls
in the Android
designer.

The simplest option is to install the 64-bit version of JDK 1.8 since it is
backwards compatible with all of the previous API levels and supports the new
Android designer features.

(One unfortunate complication with JDK 1.8 is that is not compatible with
the outdated version of Proguard that is included in the Android SDK. Currently
this will cause an error "Unsupported class version number [52.0]" when
attempting to use the Proguard or Multidex features in Xamarin.Android. See
44187. I would recommend that you install this on the side of the default version that Android ships in android-sdk\tools\proguard. Simply rename the existing folder to something else and add the new version of proguard.)

How do I solve java.lang.UnsupportedClassVersionError?

Open Command Palette and choose Java: Configure Java Runtime. Turn to Java Tooling Runtime, select java12 as JDK for Language Server:

Sample Image

Don't forget to reload Window to make this change effective.

Unsupported major.minor version 52.0 in Visual Studio + Xamarin

You'll have to install the Java JDK 1.8. I would suggest removing 1.7 unless you need to use previous versions. The release notes for Xamarin.Android 7.0 have more information as well: https://developer.xamarin.com/releases/android/xamarin.android_7/xamarin.android_7.0/

Note: Xamarin.Android 7.0 requires JDK 1.8 to use the Android Nougat
(API 24) APIs. You can continue to use earlier versions of the JDK if
targeting earlier Android API levels:

JDK 1.8 - up to API 24+ JDK 1.7 - up to API 23 JDK 1.6 - up to API 20
Additionally, a 64-bit version of the JDK is required to use custom
controls in the Android designer.

How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

The version number shown describes the version of the JRE the class file is compatible with.

The reported major numbers are:

Java SE 18 = 62,
Java SE 17 = 61,
Java SE 16 = 60,
Java SE 15 = 59,
Java SE 14 = 58,
Java SE 13 = 57,
Java SE 12 = 56,
Java SE 11 = 55,
Java SE 10 = 54,
Java SE 9 = 53,
Java SE 8 = 52,
Java SE 7 = 51,
Java SE 6.0 = 50,
Java SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45

(Source: Wikipedia)

To fix the actual problem you should try to either run the Java code with a newer version of Java JRE or specify the target parameter to the Java compiler to instruct the compiler to create code compatible with earlier Java versions.

For example, in order to generate class files compatible with Java 1.4, use the following command line:

javac -target 1.4 HelloWorld.java

With newer versions of the Java compiler you are likely to get a warning about the bootstrap class path not being set. More information about this error is available in a blog post New javac warning for setting an older source without bootclasspath.

Xamarin Visual Studio - Unsupported major.minor version 52.0

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/



Related Topics



Leave a reply



Submit