Skip to content

Xamarin.Android 10.2.0.16

Pre-release
Pre-release
Compare
Choose a tag to compare
@brendanzagaeski brendanzagaeski released this 03 Dec 21:28

December 3, 2019 — Xamarin.Android 10.2.0.16 was released as part of Visual Studio 2019 version 16.5 Preview 1.

Important: The names for generated Java types are different in this release. Any project that explicitly uses one of the old names that starts with md5 will need to be updated by hand to account for this change. See Breaking change for generated Java type names below for more details.

Corresponding Visual Studio 2019 Preview release notes

What's new

Breaking change for generated Java type names

The fallback option in Xamarin.Android 10.1 that allowed using the old style of generated Java type names that started with md5 has now been removed.

Authors of projects that include literal uses of generated Java type names that start with md5 will now need to transition to alternatives like the [Register] attribute and the [Activity] attribute.

Projects that have the LowercaseMD5 fallback option set in the $(AndroidPackageNamingPolicy) MSBuild property will now fail to build with the following error:

error XAGJS7015: System.NotSupportedException: PackageNamingPolicy.LowercaseHash is no longer supported.

To resolve the error, remove the section for the $(AndroidPackageNamingPolicy) property from your .csproj file:

<PropertyGroup>
  <AndroidPackageNamingPolicy>LowercaseMD5</AndroidPackageNamingPolicy>
</PropertyGroup>

See the Xamarin.Android 10.1 release notes for additional background information about this change and examples of how to update existing projects.

Build and deployment performance

  • GitHub PR 3692: For the specific scenario of Debug builds that have Use Fast Deployment enabled, undo part of the change from GitHub PR 2718 so that type mappings are parsed at run time instead of being compiled into unmanaged native shared libraries. This reduced the time for the GenerateJavaStubs task from about 540 milliseconds to about 320 milliseconds for an incremental build of a test app where the MainActivity type was modified between builds. As expected, this did increase the app startup time from about 1.30 seconds to about 1.35 seconds, but that still left an overall savings of approximately 170 milliseconds.
  • GitHub PR 3856: Add a fallback naming scheme for the files that mark whether the outputs of the _CompileAndroidLibraryResources target are up-to-date with the input files. This allows projects that use a google-services.json item and that are configured to use AAPT2 to skip the _CompileAndroidLibraryResources target correctly during incremental builds.
  • GitHub PR 3889: Update the _GeneratePackageManagerJavaForDesigner target to check the timestamp of the MonoPackageManager_Resources.java output file instead of the old obsolete MonoPackageManager.java file that was used in Xamarin.Android 9.3 and earlier. This reduced the total time for the SetupDependenciesForDesigner target by about 500 milliseconds for a small app on a test system. The SetupDependenciesForDesigner targets runs in the background for interactive scenarios in Visual Studio after an Android resource has changed.
  • GitHub PR 3891: Avoid unnecessary changes to the build.props intermediate file during design-time builds so that the UpdateGeneratedFiles and SetupDependenciesForDesigner targets can skip the _ResolveLibraryProjectImports target. This reduced the time for the UpdateGeneratedFiles target by about 300 milliseconds for a small app on a test system. The UpdateGeneratedFiles target runs in the foreground each time an Android resource is saved, so this makes Visual Studio more responsive when working on Android resources.

App startup performance

  • GitHub PR 3729: Initialize application logging and uncaught exception handling lazily. This reduced the time to display the first screen of a small test Xamarin.Forms app from about 783 milliseconds to about 754 milliseconds for a Release configuration build on a Google Pixel 3 XL device.
  • GitHub PR 3780: Simplify how Android system properties are looked up for internal uses within the Xamarin.Android runtime. This cut off about 1 millisecond from the total app startup time.

D8 enabled by default for all projects

Xamarin.Android has included an option to use the D8 DEX compiler since Xamarin.Android 9.2, but is has so far been disabled by default to provide a gradual path for finding and addressing compatibility issues. Starting in Xamarin.Android 10.2, the D8 DEX compiler option is now enabled by default for both existing and new projects.

To switch back from D8 to the earlier DX compiler for a particular project, set the Dex compiler option in the Visual Studio project property pages to dx, or set the $(AndroidDexTool) MSBuild property to dx by hand in your .csproj file:

<PropertyGroup>
  <AndroidDexTool>dx</AndroidDexTool>
</PropertyGroup>

Android App Bundle publishing format workflow improvements

Xamarin.Android 10.2 adds two improvements to the support for Android App Bundle publishing format to align it more closely with the support for the APK publishing format.

The first change is that the Xamarin.Android MSBuild targets now copy the unsigned .aab file to the output directory. Previously, only the signed .aab file was copied to the output directory. The unsigned file can be useful in continuous integration environments where you might want to build just the PackageForAndroid MSBuild target to generate an unsigned .aab file that you can sign in a separate step.

This change resolve the following issue:

  • GitHub 3804: Building the PackageForAndroid target, for example by running msbuild -restore -p:Configuration=Release -t:PackageForAndroid, does not output an unsigned .aab file to the output path in projects configured to use the Android App Bundle publishing format.

The second change is that the directory name for the mono-symbolicate .pdb symbol file archive now ends with the expected .aab.mSYM extension instead of .apk.mSYM.

Mono Framework version update

This version of Xamarin.Android updates the Mono 6.6 runtime and class libraries from Commit e1ef7743 to Commit 062f0ab8, adding 1 new commit.

This update does not contain any changes that affect Xamarin.Android. The update just keeps the Mono commit aligned with Xamarin.iOS, Xamarin.Mac, and Visual Studio for Mac.

XA2001 error for nonexistent Android resources

Xamarin.Android 10.2 adds a new XA2001 build error to identify cases where projects might unintentionally include references to Android resource file paths that do not exist. Example:

error XA2001: Source file 'Resources\layout\missing.xml' could not be found.

Before this change, projects that included references to nonexistent Android resources would rebuild the _CompileResources and _UpdateAndroidResgen targets on every build. The new error protects against this by ensuring that project authors remove references to nonexistent resources.

AAPT2 version update to 3.5.0-5435860

The version of the Android Asset Packaging Tool AAPT2 included in
Xamarin.Android has been updated from 3.4.1-5326820 to 3.5.0-5435860.

Issues fixed in Xamarin.Android 10.2.0.16

Application and library build process

  • GitHub PR 3410: Messages similar to resources.arsc in APK 'android.jar' is compressed were incorrectly surfaced as build errors rather than warnings.
  • GitHub 3423: A misleading The "FilterAssemblies" task failed unexpectedly build error was shown instead of the expected Metadata file ... could not be found error when an app project referenced a .NET Standard library that did not build successfully.
  • GitHub 3727: Device could not find component named: ... MainActivity ... The application could not be started. prevented launching an app successfully if the app had been uninstalled by hand between two Debug deployments.
  • GitHub 3849: warning XA0107: Ignoring as it is a Reference Assembly could appear without any mention of the name of the problematic assembly.

Application behavior on device and emulator

  • Developer Community 878335: Starting in Xamarin.Android 10.1, Java.Lang.ClassNotFoundException: md545536373befe5ba5b0be978b998d36b6.TestSuiteActivity_TestData prevented running Xamarin.Android unit test app projects.

Thank you

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

Open source