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.)


Unsupported major.minor version 52.0

This error message is caused by an incompatibility with the Java JDK: Android SDK Build-tools versions 24 and higher require Java JDK 8 (1.8), whereas earlier versions were still compatible with Java JDK 7 (1.7). (This resembles older answers about the same error.)

Steps to update:

  1. Update to Java JDK 8. It is recommended to use the 64-bit version for compatibility with the new Xamarin Android designer features in Xamarin Studio 6.1 and Xamarin for Visual Studio 4.2.

  2. Double-check that Java JDK 8 is selected in the Xamarin preferences:

    • Visual Studio: Tools > Options > Xamarin > Android Settings > Java Development Kit Location.

      "Tools > Options > Xamarin > Android Settings > Java Development Kit Location" in Visual Studio

    • Xamarin Studio (on Mac): Xamarin Studio > Preferences > Projects > SDK Locations > Android > Java SDK (JDK).

      "Xamarin Studio > Preferences > Projects > SDK Locations > Android > Java SDK (JDK)"

  3. Install Android SDK Build-tools 24.0.1 or higher.

  4. (Optional) Uninstall the older Android SDK Build-tools 24 that has a bug in aapt:

Alternatives:

If you would rather not update to Java JDK 8 yet, you can instead do one of the following.

  • Uninstall all Android SDK Build-tools versions 24 and higher via the Android SDK manager.

  • Or set the AndroidSdkBuildToolsVersion MSBuild property to an earlier version. For example, if you also have version 23.0.3 installed, you could add the following line within the top <PropertyGroup> element in the Android project .csproj file:

    <AndroidSdkBuildToolsVersion>23.0.3</AndroidSdkBuildToolsVersion>
    

(See also https://releases.xamarin.com/technical-bulletin-android-sdk-build-tools-24/.)


Additional background info

Update July 25, 2016:

Google has now released Android SDK Build-tools 24.0.1. That version fixes a bug in aapt that was present in version 24.


Update July 14, 2016:

Unsupported major.minor version 52.0

It turns out this error message is caused by an incompatibility with the Java JDK rather than with Xamarin.Android: Android SDK Build-tools version 24 requires Java JDK 1.8, whereas earlier versions were still compatible with Java JDK 1.7. (This resembles older answers about the same error.)


Update June 16, 2016:

The non-preview version of Android SDK Build-tools version 24 is now available in the Android SDK Manager. Xamarin.Android is not yet compatible with that version either.


Info from April 12, 2016:

SDK Build Tools Version: 24 rc2

The "Build Tools Version" looks like it might be the problem. Xamarin.Android is not yet compatible with the "24 rc2" Build-tools version from the "Preview Channel" in the Android SDK Manager. You can uninstall that preview version and install one of the non-preview versions of the Build-tools (such as 23.0.3) using the Android SDK Manager.