Xamarin.Android 12.2 release notes

| GitHub | Developer Community | System requirements | Blogs |


Xamarin.Android 12.2 releases are distributed as part of Visual Studio 2022 17.1.

What's new in Xamarin.Android 12.2

Xamarin.Android 12.2 releases

Xamarin.Android version

Released February 15, 2022, and included in Visual Studio 2022 version 17.1 and Visual Studio 2022 for Mac Preview.

IDE Improvements

  • GitHub Issue 6737: Add " (Preview)" to the "Android Java Library Binding (Preview)" template name to differentiate the .NET 6 template ("Preview") from the Classic Xamarin.Android template. (#6377)

Android 12L Preview Bindings

Application and library build and deployment

  • Improve reliability of building Xamarin.Android projects in a directory containing non-ASCII characters. (#6273)

  • Support Android NDK r23b
    (PR #6414, Commit 617500c9, PR #6518, Commit d56398b4)

  • Bump SQLite to 3.37.1.
    (PR #6530, Commit c52e6e68, PR #6602, Commit 4153fc6f)

    Note: we encountered an "undocumented breaking change", probably in sqlite/sqlite@c2df4d6a: if a column type is one of a known set of types, then the column type is stored in the bit-field, not as a separate string.

    For example, given:


    if you query the type of the DATA column, SQLite will now return BLOB, whereas previously it would return blob; the case is no longer preserved. This broke one of our unit tests, which was fixed by using a case-insensitive comparison.

  • Add [DynamicDependency] for AndroidMessageHandler
    (#60896, PR #6445, Commit ff202f25)

    Fixes a JavaProxyThrowable unhandled exception because of a nested MissingMethodException when running a Release app under .NET 6, as AndroidMessageHandler was missing a default constructor:

    Android.Runtime.JavaProxyThrowable: Exception_WasThrown, Android.Runtime.JavaProxyThrowable
    --- End of managed Android.Runtime.JavaProxyThrowable stack trace ---
    android.runtime.JavaProxyThrowable: System.Reflection.TargetInvocationException: Arg_TargetInvocationException
    ---> System.Reflection.TargetInvocationException: Arg_TargetInvocationException
    ---> System.MissingMethodException: Arg_NoDefCTor, Xamarin.Android.Net.AndroidMessageHandler
        at System.RuntimeType.CreateInstanceMono(Boolean , Boolean )
        at System.RuntimeType.CreateInstanceDefaultCtor(Boolean , Boolean )
        at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
        at System.Activator.CreateInstance(Type type, Boolean nonPublic)
        at System.Activator.CreateInstance(Type type)
        at Android.Runtime.AndroidEnvironment.GetHttpMessageHandler()
  • Fix methods using Android.Telephony.Data.* enums.
    (Issue #6527, PR #6535, Commit c4b02d7b)

  • Add $(AndroidManifestMergerExtraArgs).
    (PR #6397, Commit 3f347d83)

    The new $(AndroidManifestMergerExtraArgs) MSBuild property allows providing manifestmerger.jar options in addition to what the <ManifestMerger/> task provides (2c6f5cd1), which already emits --main, --overlays, --libs, --placeholder, and --out.

    This allows easily specifying --log, if desired:

    <AndroidManifestMergerExtraArgs>--log VERBOSE</AndroidManifestMergerExtraArgs>
  • Don't package empty AOT-d DSOs
    (Issue #3932, PR #6477, Commit db161ae7)

  • Don't use java -XX:-UseSplitVerifier.
    (PR #6531, Commit 94e21c7a)

    The <JarToXml/> task used java -XX:-UseSplitVerifier, which is no longer supported on JDK 11. The result is that Android Binding Project builds which still use jar2xml.jar would fail to build:

    Unrecognized VM option 'UseSplitVerifier'
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.

    The -XX:-UseSplitVerifier option is no longer required. Remove it.

  • Improve javac -version version parsing
    (PR #6576, Commit a0d83441)

  • $(AndroidNdkDirectory) is optional
    (PR #6539, Commit c96d9f49)

    Use of AOT and Profiled AOT no longer requires a full Android NDK installation.

    Building with LLVM enabled still requires a full NDK installation.

  • Bump XA0113 warning to API-30
    (PR #6548, Commit c35b718d)

  • class-parse.exe as separate process
    (PR #6551, Commit 014c1cb1)

  • Don't skip symbol-less AOT libs
    (Issue #6615, PR #6630, Commit d3cd4638)

    Xamarin.Android 12.2 preview releases had a bug wherein when AOT was enabled and the $(AndroidAotAdditionalArguments) MSBuild property contained the value no-write-symbols,nodebug, then no libaot-*.so files would be added to .apk or .aab files. This bug has been fixed.

  • default $(AndroidUseAssemblyStore) to false for debug builds
    (Issue #1430409, Issue #6480, PR #6660, Commit 19b97b76)


Bindings projects

  • Rework generator type system.
    (PR #6436, Commit f658ab26, Commit 43243b4d, PR #6444, Commit 29740ab8)

    The generator type system is used to determine what Java types exist, what methods are added, what methods are overridden, etc. The type system has been updated to improve reliability, with the caveat that this may break things.

    If your Android Binding Library projects get new errors, please file a bug and then set the $(_AndroidUseJavaLegacyResolver) MSBuild property to True.

  • Attempt to better infer Java parameter names from .class files when javac -parameters wasn't used.
    (PR #6471, Commit dcdcce13, Commit f7d3684d)

.NET 6 Changes

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.1 is based on the open-source Xamarin.Android repositories: