Xamarin.Android 10.3.99.230
Pre-releaseMay 19, 2020 — Xamarin.Android 10.3.99.230 was published as part of Visual Studio 2019 version 16.7 Preview 1 and Visual Studio 2019 for Mac version 8.7 Preview 1.
Corresponding Visual Studio 2019 Preview release notes
What's new
- Build and deployment performance
- Mono.Android nullable reference types compatibility
- Tidier IntelliSense suggestions for Java.Lang.Object subclasses
- Issues fixed
- Known issues
- Installing
- Thank you
- Open source
Deprecations, removals, and default configuration changes
Build and deployment performance
- GitHub PR 4190: Switch to running AAPT2 in single-file mode rather than
--dir
mode. This reduced the total incremental build time from about 16.4 seconds to about 5.5 seconds for a test project when a single Android resource file was changed between builds. - Java.Interop GitHub PR 624, Java.Interop GitHub PR 627, Java.Interop GitHub PR 628: Update the CRC-64 algorithm used during builds to take advantage of a more efficient calculation technique. This reduced the total incremental build time from about 8.7 seconds to about 8.5 seconds for a small Xamarin.Forms app when one line of a C# file was changed between builds.
Mono.Android nullable reference types compatibility
The Mono.Android assembly has been annotated for compatibility with C# 8.0 nullable reference type checks. Projects can now optionally place code that uses types from Mono.Android in a nullable context to take advantage of additional compiler nullability checks. For example, to enable nullability checks for all code in a project, set the Nullable
MSBuild property to enable
in the .csproj file:
<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>
When this property set, the build will emit warnings if any code does not properly account for possible null
values passed into or returned from APIs in the Mono.Android assembly.
See the nullable reference types documentation for more information.
Note: The majority of Mono.Android, including the nullability annotations, is automatically generated from the Android Java source. The annotations intentionally preserve any upstream bugs in the nullability information provided by the Android source code.
Tidier IntelliSense suggestions for Java.Lang.Object subclasses
Java.Lang.Object
contains several properties and methods that are required to be public
to support Xamarin.Android Java bindings but are not intended to be used in hand-written code. These members are now hidden from IntelliSense, making it easier to find the useful members.
Bindings projects XA4231 and XA4232 warnings for deprecated settings
XA4231 warning for deprecated jar2xml parser
Any bindings project that has the AndroidClassParser
MSBuild property set to the old jar2xml
parser or any other unrecognized value will now get a XA4231 build warning:
warning XA4231: The Android class parser 'jar2xml' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse' instead.
To resolve this warning, update the Android Class Parser setting in the Visual Studio project property pages or the .jar file parser setting in Visual Studio for Mac to class-parse. This corresponds to the class-parse
value for the AndroidClassParser
MSBuild property in the .csproj file:
<PropertyGroup>
<AndroidClassParser>class-parse</AndroidClassParser>
</PropertyGroup>
XA4232 warning for deprecated XamarinAndroid code generation target
Any bindings project that has the AndroidCodegenTarget
MSBuild property set to the old XamarinAndroid
code generation target or any other unrecognized value will now get a XA4232 build warning:
warning XA4232: The Android code generation target value 'XamarinAndroid' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.
To resolve this warning, update the Android Codegen target setting in the Visual Studio project property pages or the Code generation target setting in Visual Studio for Mac to XAJavaInterop1. This corresponds to the XAJavaInterop1
value for the AndroidCodegenTarget
MSBuild property in the .csproj file:
<PropertyGroup>
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
</PropertyGroup>
Issues fixed in Xamarin.Android 10.3.99.230
Application and library build and deployment
- GitHub 2042: The Mono.Android assembly did not yet surface the nullability information provided by the upstream Android source code for use in C# 8.0 nullable contexts.
- GitHub 4439: Invalid values of the
AndroidDexTool
MSBuild property produced a misleading error during deployment instead of an error during the build. Invalid values are now ignored and the default D8 DEX tool is used instead. - GitHub PR 4578: The source directory is under the output directory. Skip it. build error did not yet mention the relevant MSBuild item type or the current path of the invalid item.
- Java.Interop GitHub PR 622: warning : Failed to read ... with debugging symbols. Retrying to load it without it. and Mono.Cecil.Cil.SymbolsNotMatchingException: Symbols were found but are not matching the assembly could appear during builds, for example for projects using obfuscation tools. To align more closely with the behavior of other common .NET project types that do not warn about mismatched debugger symbols, Xamarin.Android projects now log these as informational messages instead of warnings.
Design-time builds
- Developer Community 896179, GitHub 4273: The IDE could become unresponsive for tens of seconds after changes were saved to an Android layout file in projects configured to use AAPT2.
Bindings projects
- GitHub PR 4579: Unrecognized transform root element build error did not yet mention the relevant MSBuild item type.
- GitHub PR 4579: Specified source jar not found and Specified reference jar not found build errors did not yet mention Java library types other than JAR files.
- Java.Interop GitHub PR 611: Building a binding project that had a reference to another binding project performed some redundant work for assemblies referenced by both projects.
Application Mono Framework behavior on device and emulator
This version of Xamarin.Android updates the Mono 6.12 runtime and class libraries from Commit 165f4b03 to Commit 051408e0, adding 5 new commits.
Fixes included for issues reported with Xamarin.Android applications:
- Developer Community 952568, Mono GitHub 18865: Starting in Xamarin.Android 10.2,
SslStream.BeginRead()
andSslStream.BeginWrite()
would block if called at the same time.
IDE compatibility
- GitHub 4582: Some
Java.Lang.Object
properties and methods likeHandle
andPeerReference
appeared in IntelliSense suggestions even though they were primarily intended for use only in generated code.
Known issues in Xamarin.Android 10.3.99.230
- Developer Community 1024028, GitHub 4596, GitHub 4660: System.MemberAccessException: Cannot create an instance of ... can cause apps to abort when attempting to use certain APIs that have both generic and non-generic versions. This issue will be resolved in a future preview version.
Thank you
A big Thank You! to community members who contributed improvements in this release:
- Andrey Kurdyumov (@kant2002), GitHub PR 4275: Add compatibility with using a custom value in the
NUGET_PACKAGES
environment variable when building xamarin-android from source. - Andrey Kurdyumov (@kant2002), GitHub PR 4289: Update the instructions for building the Xamarin.Android-Tests.sln solution in xamarin-android source checkouts on Windows.
- Andrey Kurdyumov (@kant2002), GitHub PR 4332: Fix GitHub 4306 so that
xabuild
can successfully build the Xamarin.Android-Tests.sln solution more than once in xamarin-android source checkouts. - Janus Weil (@janusw), GitHub PR 4346: Update the xamarin-android source build dependencies documentation for Linux.
- Kyle Seongwoo Jun (@kyle-seongwoo-jun), GitHub PR 4525: Mention the .aab file format in addition to the .apk file format in Xamarin.Android's draft document about .NET 5.
Installing
To get the new version in Visual Studio, update Visual Studio:
- Visual Studio 2019 version 16.7 Preview 1 — Visual Studio Installer
- Visual Studio 2019 for Mac 8.7 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.4 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 #71.
- 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.