Xamarin.Android 12.0 Release Notes

| GitHub | Developer Community | System requirements | Blogs |


Xamarin.Android 12.0 releases are distributed as part of Visual Studio 2019 16.11.

What's new in Xamarin.Android 12.0

Xamarin.Android 12.0 releases

Xamarin.Android version

Released November 9, 2021, included in Visual Studio 2019 version 16.11.6.

Support Android 12

Android 12 adds a number of new APIs in API-31, which are now available when $(TargetFrameworkVersion)=v12.0.

There is unfortunate related fallout: API-31 requires JDK-11, and using JDK-11 with Visual Studio 2019 is problematic; in particular, using JDK-11 will break the Android Designer. If Android 12/API-31 must be used with Visual Studio 2019, please keep in mind that tradeoffs are involved.

Android 12/API-31 support is improved in Visual Studio 2022 and Xamarin.Android 12.1.

API diffs between $(TargetFrameworkVersion)=v11.0 and $(TargetFrameworkVersion)=v12.0.






  • Fix ArgumentException in <GenerateCompressedAssembliesNativeSourceFiles/>
    (PR #6032, Commit fc74854b)

    dotnet/maui is hitting a build error, such as:

    error XAGCANSF7004: System.ArgumentException: An entry with the same key already exists.
    error XAGCANSF7004:    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
    error XAGCANSF7004:    at System.Collections.Generic.TreeSet`1.AddIfNotPresent(T item)
    error XAGCANSF7004:    at System.Collections.Generic.SortedDictionary`2.Add(TKey key, TValue value)
    error XAGCANSF7004:    at Xamarin.Android.Tasks.GenerateCompressedAssembliesNativeSourceFiles.GenerateCompressedAssemblySources()
    error XAGCANSF7004:    at Xamarin.Android.Tasks.GenerateCompressedAssembliesNativeSourceFiles.RunTask()
    error XAGCANSF7004:    at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17

    Reviewing the <GenerateCompressedAssembliesNativeSourceFiles/> MSBuild task, it appears the ContainsKey() check is not using the correct key for the dictionary.

  • Add OpenTK/NUnitLite Error for .net 6
    (PR #6031, Commit 1fb3c82c)

  • Add support for android:useEmbeddedDex
    (Issue ##5925, PR #6042, Commit 6b87c5b6)

    When //application/@android:useEmbeddedDex is true, store classes.dex within the .apk, instead of adding it as compressed data. This prevents installation errors such as:

    Failure [INSTALL_FAILED_INVALID_APK: Some dex are not uncompressed and aligned correctly
  • Fix Assembly Ordering in PackageManager
    (PR #6057, Commit d80c9b14)

  • .NET 6 builds fail on Apple M1
    (#6091, PR #6092, Commit 7dacdd75)

  • Fix NullReferenceException in Xamarin.Android.Common.targets
    (#6124, PR #6126, Commit 27e91bb4)

  • Fix XA0031 message
    (PR #6225, Commit 95584415)

  • Improve XA0031 error message
    (PR #6252, Commit 658db25e)

  • update built-in AOT profiles
    (PR #6247, Commit e9a4c9f9)

  • Fix default $(LintToolPath)
    (PR #6293, Commit 4364b4ca)

  • don't add exported="true" if already present
    (#6284, PR #6290, Commit 9f2d3bfa)

.NET 6 Changes

Thank you

A big Thank You! to community members who contributed improvements in this release

Feedback welcome

Your feedback is important to us. If there are any problems with this release, check our GitHub Issues, Xamarin.Android Community Forums and Visual Studio Developer Community for existing issues. For new issues within the Xamarin.Android SDK, please report a GitHub Issue. For general Xamarin.Android experience issues, let us know via the Report a Problem option found in your favorite IDE under Help > Report a Problem.

Open source

Xamarin.Android 12.0 is based on the open-source Xamarin.Android repositories: