java Lang UnsupportedClassVersion Error in Xamarin Studio

后端 未结 11 1829
终归单人心
终归单人心 2020-11-27 02:39

I am getting the following error when I am building my project . How do I correct this ?

C:\\Program Files (x86)\\MSBuild\\Xamarin\\Android\\Xamarin.Android.Common.t

相关标签:
11条回答
  • 2020-11-27 03:38

    SOLUTION!

    Change the Java SDK to 1.8.x. After restarting Visual Studio, run "Clean Solution", "Build" and be happy!

    0 讨论(0)
  • 2020-11-27 03:40

    I faced the same issue, my system had java version 1.7 installed. I installed the 1.8 version in system.

    Updated path of jdk Tools->Options->Xamarin->android settings->(java development kit location)set jdk path to new jdk version

    rebuid project again, problem resolved.

    0 讨论(0)
  • 2020-11-27 03:41

    Make sure that if in VS you go to
    Project > Project Name Properties > Application
    you have downloaded all of the selected versions in the Android SDK

    Let's say that you have only installed the API's for Android 6.0 (Level 23) and 5.1.1 (Level 22), but you are setting your Minimum Android to target to a level below that Level 16 for example. It'll give the java.lang.UnsupportedClassVersionError: error.

    Just Make sure you use the correct API Level

    0 讨论(0)
  • 2020-11-27 03:41

    I already use JAVA SDk1.8 latest version in VS still not solving the issue.

    But I found that I can simply remove the Android Build Tool 28, using some older version like 25, then it works like a charm.

    Do not check the build tool 28

    0 讨论(0)
  • 2020-11-27 03:45

    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.

      • Xamarin Studio (on Mac): 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.

    0 讨论(0)
提交回复
热议问题