Xamarin.Android 10.3.0.33
Pre-releaseMarch 26, 2020 — Xamarin.Android 10.3.0.33 was published as part of Visual Studio 2019 version 16.6 Preview 2 and to the Preview updater channel of Visual Studio 2019 for Mac version 8.6 Preview 1
Corresponding Visual Studio 2019 Preview release notes
What's new
- Preview bindings for Android 11 Developer Preview
- Build and deployment performance
- App startup performance
- Mono Framework version update to 6.12
- Removal of AndroidExplicitCrunch feature
- Removal of keystore certificate fingerprint from build output
- Compatibility with embedded debug information
- Localized warnings and errors for builds
- Issues fixed
- Installing
- Open source
Preview bindings for Android 11 Developer Preview
This version includes preview bindings for the first Developer Preview of Android 11 from Google. See the Android 11 Developer Preview documentation for additional information about the behavior and API changes in this new Android version. To try the bindings for the new APIs in a Xamarin.Android project, set Compile using Android version: (Target Framework) to Android 10.0.99 (R) under the Application tab of the Visual Studio project property pages. This sets the TargetFrameworkVersion
property to v10.0.99
in the .csproj file:
<TargetFrameworkVersion>v10.0.99</TargetFrameworkVersion>
New features
These bindings take advantage of C# 8.0's support for default and static interface members to provide C# interface APIs that more closely match the original Android APIs.
For example, in the Android.Views.TextClassifiers
namespace, TextClassifier.HintTextIsEditable
is now available as ITextClassifier.HintTextIsEditable
, and the old TextClassifier.HintTextIsEditable
field is now marked [Obsolete]
.
Note: An older set of bindings for interface constants were also available in Consts classes like TextClassifierConsts
in earlier target framework versions. Those classes were marked [Obsolete]
for several years. They have been removed completely for the Android 10.0.99 (R) target framework version. Project authors are encouraged to switch to the new interface members like ITextClassifier.HintTextIsEditable
at their earliest convenience.
Build and deployment performance
- GitHub PR 4308: Skip executing
keytool -list
during theSignAndroidPackage
target. This saved about 200 milliseconds for theSignAndroidPackage
target for incremental builds where a new APK was generated, such as after changing an Android resource. - GitHub PR 4316: Switch the
LinkAssembliesNoShrink
task to take advantage of the caching from the new Mono.Cecil wrapper methods introduced in Java.Interop GitHub PR 570. This reduced the time for the task from about 710 milliseconds to about 700 milliseconds for an initial clean build of a small Xamarin.Forms test app. - GitHub PR 4320: Update the version of LibZipSharp used by the build tasks to 1.0.10, which switches several
byte[]
instances toSystem.Buffers.ArrayPool
instances to save on allocations. This reduced the combined time for theResolveLibraryProjectImports
andBuildApk
tasks from about 5.3 seconds to about 5.0 seconds for a small test Xamarin.Forms app on an initial clean build. - GitHub PR 4395: Remove use of temporary files during the
ConvertResourcesCases
task. This reduced the time for the task from about 610 milliseconds to about 510 milliseconds for a moderately large real-world project on initial clean builds as well as on incremental builds with Android resource changes. - Java.Interop GitHub PR 596: Use
File.Exists()
instead ofDirectoryGetFile()
in a few places. This reduced the time for theLinkAssembliesNoShrink
task from about 710 milliseconds to about 430 milliseconds for a small test Xamarin.Forms app on an initial clean build.
App startup performance
- GitHub PR 4302: Avoid unneeded calls to
GetCustomAttribute()
during app startup for the common case where an app has no types decorated with the[JniAddNativeMethodRegistration]
attribute. Additionally, instead of using a managed method to propagate uncaught exceptions from Java, use a Java method that calls into the unmanaged Xamarin.Android runtime. These changes reduced the time to display the first screen of a small test Xamarin.Forms app from about 730 milliseconds to about 700 milliseconds for a Release configuration build on a Google Pixel 3 XL device. - Java.Interop GitHub PR 582: Remove a static array initialization from
JniRuntime
and an array iteration duringJniRuntime.JniTypeManager.GetTypeSignature()
, and leverageType.GetTypeCode()
for faster lookups of builtin types.
Mono Framework version update to 6.12
Xamarin.Android now uses the Mono 6.12 runtime and class libraries at Commit d90665a4, bringing in about 350 new commits.
Removal of AndroidExplicitCrunch feature
In previous Xamarin.Android versions, setting the AndroidExplicitCrunch
MSBuild property to true
would configure the build to crunch PNG drawable resources using a separate MSBuild task before passing them to AAPT.
This feature was never compatible with projects configured to use AAPT2 and was automatically disabled in those projects. For projects configured to use the older AAPT tool, this feature could cause builds to rerun AAPT on every build. Due to these limitations, this feature has now been removed from Xamarin.Android. The AndroidExplicitCrunch
MSBuild property is now ignored. Project authors who added this property to their .csproj files in the past can now remove it.
Removal of keystore certificate fingerprint from build output
The performance improvement that skips executing keytool -list
during the build means that the SHA-1 certificate fingerprint no longer appears in the build output. To determine certificate fingerprints in this version, follow the steps from the Finding your Keystore's Signature guide instead.
Compatibility with embedded debug information
The Mono Framework version in this Xamarin.Android version adds compatibility for reading embedded debugging information from assemblies built with Build > Advanced > Debugging information set to Embedded in the Visual Studio project property pages. This corresponds to the embedded
value for the DebugType
MSBuild property in the .csproj file:
<PropertyGroup>
<DebugType>embedded</DebugType>
</PropertyGroup>
See the symbol embedding design documentation for more information.
Localized warnings and errors for builds
Many of the warnings and errors in the Xamarin.Android build tasks now provide localized messages that match the region and language settings of the build environment.
Issues fixed
Application and library build and deployment
- Developer Community 861086: Starting in Xamarin.Android 10.1, errors similar to 'fixedsize' is incompatible with attribute ChildLayout (attr) enum prevented building projects successfully if they contained custom attribute names ending with the word Layout.
- GitHub PR 4340: error XA0031: Java SDK 1.8 or above is required when targeting FrameworkVersion did not yet mention the full MSBuild property name
TargetFrameworkVersion
. - GitHub PR 4357: error XA0003 and error XA0004 messages did not yet mention AndroidManifest.xml or include the full name of the
android:versionCode
XML attribute. - GitHub PR 4378: Misleading error MSB6006: "jarsigner.exe" exited with code 1 or error MSB6006: "java.exe" exited with code 2 was shown if the
AndroidKeyStore
MSBuild property wastrue
and theAndroidSigningKeyStore
property was set to a file that did not exist. - GitHub PR 4387: error XA1010: Invalid application placeholders... did not yet mention the associated
AndroidManifestPlaceholders
MSBuild property or list the current value of the property.
Application Mono Framework behavior on device and emulator
- GitHub 1368, GitHub 2049, GitHub 2518, GitHub 3035, GitHub 3905, Mono GitHub 14282, Mono GitHub PR 18239: System.ObjectDisposedException: Cannot access a disposed object. ... at Java.Interop.JniPeerMembers.AssertSelf could cause apps to exit unexpectedly.
- Mono GitHub 9314: Assertion at ... sgen-tarjan-bridge.c:1140, condition `xref_count == xref_index' not met could cause apps to exit unexpectedly.
Installing
To get the new version in Visual Studio, update Visual Studio:
- Visual Studio 2019 version 16.6 Preview 2 — Visual Studio Installer
- Visual Studio 2019 for Mac version 8.6 Preview 1 — Visual Studio for Mac Installer with the Preview updater channel
For other scenarios, the latest commercial .vsix and .pkg installer packages can be found in the project README.
Open source
Xamarin.Android 10.3 is based on the open-source Xamarin.Android repositories:
- The Mono runtime and class library artifacts for this version come from the android-release-Darwin-*.7z archive generated by the Mono open-source build: archive-mono/job/2020-02 build #46.
- Core JNI interaction logic is in the Java.Interop repo.
- Android bindings and MSBuild tooling are in the xamarin-android repo.
- Chat is in the
xamarin/xamarin-android
Gitter channel.