Xamarin v10.3.1.0 Release Notes
Release Date: 2020-05-19 // almost 4 years ago-
May 19, 2020 โ Xamarin.Android 10.3.1.0 was published as part of Visual Studio 2019 version 16.6 and Visual Studio 2019 for Mac version 8.6.
๐ Corresponding Visual Studio 2019 release notes
- ๐ Visual Studio 2019
- ๐ Visual Studio 2019 for Mac
What's new compared to Xamarin.Android 10.2
- ๐ Build and deployment performance
- ๐ App startup performance
- ๐ Android resource editing performance
- โก๏ธ Mono Framework version update to 6.12
- Preview bindings for Android 11 Developer Preview 2
- ๐ R8 configured to suppress common build errors
- ๐ More thorough clean of obj directory between builds
- Compatibility with embedded debug information
- ๐ง Support for Android App Bundle configuration files
- ๐ Stream.Seek() for file streams from Android APIs
- ๐ Localized errors and warnings for builds
- Java.Interop nullable reference types compatibility
- โก๏ธ Mono.Data.Sqlite SQLite version update
- ๐ Issues fixed
- Installing
- Thank you
- Open source
๐ง Deprecations, removals, and default configuration changes
- โก๏ธ Default Android tools versions update to 29.0
- XA1011 error for D8 with ProGuard
- ๐ฆ XA0122 and CS0618 warnings for deprecated Java.Interop.DoNotPackageAttribute
- CS0619 error for obsolete constant fields
- Bindings projects exclusion of private nested types
- Removal of AndroidExplicitCrunch feature
- ๐ Removal of F# Resource.designer.fs file support
- ๐ Removal of keystore certificate fingerprint from build output
- ๐ Removal of .exe reference support
๐ Build and deployment performance
- GitHub PR 3885: Adjust caching of device information during the build so it covers the case where no device or emulator is found. This reduced the time for the
DetectIfAppWasUninstalled
task from about 2 seconds to about 0 seconds, bringing the total time down closer to the time for a build where a device or emulator is available. - ๐ GitHub PR 3999: Allow
BuildApk
to merge new files into the previous APK instead of generating a new APK from scratch for incremental builds where an Android resource file has changed. This reduced the incremental build time for theBuildApk
step from about 4 seconds to about 0.7 seconds for a small test app when one Android resource file was changed between builds. - ๐ GitHub PR 4158: Update the default order of strategies used to detect installed packages to minimize time for modern devices. This can potentially save about 100 milliseconds for the first deployment of an app after launching Visual Studio.
- ๐ GitHub PR 4215: Remove a redundant call to the
ResolveAssemblyReference
task during the_ResolveSatellitePaths
target. This reduced the total time spent in calls toResolveAssemblyReference
from about 240 milliseconds to about 150 milliseconds for incremental builds of a medium sized project. The same savings also apply to the deployment step, resulting in an approximate combined savings of 180 milliseconds for build and deployment of the test project. - ๐ GitHub PR 4236: Use a
Lazy<T>
type to access the NuGet lock file so it is only loaded when needed, and remove some redundant logging messages. This reduced the total time for theResolveAssemblies
task from about 320 milliseconds to about 240 milliseconds for incremental builds of a medium sized project. The same savings also apply to the deployment step, resulting in an approximate combined savings of 160 milliseconds for build and deployment of the test project. - GitHub PR 4251: Reuse
MemoryStream
instances throughout the Xamarin.Android build targets to save on allocations. This reduced the combined time for the_GenerateJavaStubs
,_ResolveLibraryProjectImports
, and_GeneratePackageManagerJava
targets from about 3.3 seconds to about 3.0 seconds for an incremental build of a test app where theMainActivity
type was modified between builds. - ๐ GitHub PR 4260: Remove unneeded calls to
string.Format()
during theLinkAssembliesNoShrink
task. This reduced the time for the task from about 800 milliseconds to about 770 milliseconds for an initial clean build of a small Xamarin.Forms test app. - ๐ GitHub PR 4268, Java.Interop GitHub PR 570: Implement and switch to a new set of wrapper methods around the Mono.Cecil methods to allow caching the results during the
GenerateJavaStubs
task. This reduced the time for the task from about 1.4 seconds to about 0.9 seconds for an initial clean build of small test Xamarin.Forms test app. - ๐ GitHub PR 4303: Replace string interpolation during typemap assembly code generation in
GenerateJavaStubs
with sequential calls toStreamWriter.Write()
. This reduced the total time forGenerateJavaStubs
from about 1.3 seconds to about 0.9 seconds for an initial clean build of a small Xamarin.Forms test app. - ๐ 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 559: Switch from using
Assembly.GetName().Name
to usingAssembly.FullName
combined withstring.Substring()
inJavaNativeTypeManager.GetPackageName()
. This reduced the time forGenerateJavaStubs
from about 390 milliseconds to about 360 milliseconds for an initial clean build of a small Xamarin.Forms test app. - ๐ Java.Interop GitHub PR 577: Change a LINQ expression to a loop in Java.Interop's
IsSubclassOf()
extension method. This reduced the time forGenerateJavaStubs
from about 560 milliseconds to about 540 milliseconds for an initial clean build of a small Xamarin.Forms test app. - ๐ 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 3958: Skip scanning for .exe files during app startup because Xamarin.Android apps only expect .dll assemblies. This reduced the
Runtime.init()
phase of application startup for a small test app from about 165 milliseconds to about 164 milliseconds on a Google Pixel 3 XL device and from about 530 milliseconds to about 450 milliseconds on an x86 emulator using HAXM. - ๐ GitHub PR 3992: Optimize the storage format of the per-application Java-to-managed and managed-to-Java type mappings to allow more efficient lookups. This reduced the time to display the first screen of a small test Xamarin.Forms app from about 800 milliseconds to about 790 milliseconds for a Release configuration build on a Google Pixel 3 XL device.
- ๐ GitHub PR 4302: Avoid unneeded calls to
GetCustomAttribute()
during app startup for the common case where an app has no types decorated withJniAddNativeMethodRegistrationAttribute
. 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 541 Add
[MethodImpl (MethodImplOptions.AggressiveInlining)]
to Java.Interop methods and properties that are called many times during Xamarin.Forms app startup. This reduced the time to display the first screen of a blank Xamarin.Forms app from about 560 milliseconds to about 540 milliseconds for a Release configuration build on a Google Pixel 3 XL device. - ๐ Java.Interop GitHub PR 555: Implement and switch to a new
JniTypeManager.GetTypeSignature()
method that returns aJniTypeSignature
instance instead of anIEnumerable<JniTypeSignature>
. This reduced the time to display the first screen of a small test Xamarin.Forms app from about 760 milliseconds to about 750 milliseconds for a Release configuration build on a Google Pixel 3 XL device. It also reduced the number of object allocations from about 9300 to about 8900. - ๐ Java.Interop GitHub PR 557: Remove unneeded calls to
IntrospectionExtensions.GetTypeInfo()
now that Java.Interop is a .NET Standard library rather than a PCL. This reduced the time to display the first screen of a small test Xamarin.Forms app from about 755 milliseconds to about 753 milliseconds for a Release configuration build on a Google Pixel 3 XL device. - Java.Interop GitHub PR 574: Skip calling
GetCustomAttribute()
in cases whereJniTypeManager.GetSimpleReference()
can be used instead. - ๐ 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 GitHub PR 19102: Use
GArray
instead ofGList
when getting custom attributes from an image. This reduces the number of memory allocations during app startup for a standard Xamarin.Forms app, which should improve startup times by several milliseconds.
๐ Android resource editing performance
- โก๏ธ GitHub PR 3674: Correct the
Inputs
for the_ManagedUpdateAndroidResgen
target so that the target is skipped as expected during incremental design-time builds.
โก๏ธ Mono Framework version update to 6.12
๐ Xamarin.Android now uses the Mono 6.12 runtime and class libraries at Commit 165f4b03, bringing in about 900 new commits.
Preview bindings for Android 11 Developer Preview 2
This version includes preview bindings for the second 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 tov10.0.99
in the .csproj file:\<TargetFrameworkVersion\>v10.0.99\</TargetFrameworkVersion\>
๐ New features
0๏ธโฃ 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 asITextClassifier.HintTextIsEditable
, and the oldTextClassifier.HintTextIsEditable
field is 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 likeITextClassifier.HintTextIsEditable
at their earliest convenience.๐ R8 configured to suppress common build errors
๐ง Xamarin.Android now configures R8 to skip emitting errors for Java dependency warnings such as:
R8 : warning : Missing class: org.apache.http.client.methods.HttpEntityEnclosingRequestBase R8 : warning : Missing class: java.lang.ClassValue R8 : error : Compilation can't be completed because some library classes are missing.
This allows a more gradual transition to R8, particularly for projects that are using R8 for multidex only and not code shrinking.
Although these R8 warnings will no longer cause the build to fail, project authors are encouraged to address the warnings at their earliest convenience and then set R8 back to its original stricter behavior. To restore the original behavior, set the
AndroidR8IgnoreWarnings
MSBuild property tofalse
in the .csproj file:\<PropertyGroup\> \<AndroidR8IgnoreWarnings\>false\</AndroidR8IgnoreWarnings\> \</PropertyGroup\>
Example: How to solve Missing class: org.apache.http.client
R8 : warning : Missing class: org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Best solution
โก๏ธ Update any NuGet packages or Java dependencies that use the Apache HTTP client to newer versions that use
java.net.HttpURLConnection
instead. This is the best solution because starting in Android 6.0 Marshmallow (API level 23), the Apache HTTP client is deprecated in favor of the more efficientHttpURLConnection
.Second-best solution
โก๏ธ If new library versions are not yet available that use
HttpURLConnection
, then, where possible, update any NuGet packages that use Apache HTTP client to newer versions that include aUsesLibraryAttribute
for org.apache.http.legacy:[assembly: UsesLibrary("org.apache.http.legacy", false)]
โก๏ธ NuGet package authors who cannot yet update all Java dependencies to use
HttpURLConnection
are encouraged to add this attribute to their projects as soon as possible.This attribute automatically generates the following element under the
<application>
node of AndroidManifest.xml for any app that references the NuGet package:\<uses-library android:name="org.apache.http.legacy" android:required="false" /\>
Fallback solution
โก๏ธ If updated NuGet package versions are not yet available with the attribute, then add the same
UsesLibraryAttribute
directly to the application project instead:[assembly: UsesLibrary("org.apache.http.legacy", false)]
Background information
The Missing class: org.apache.http.client warning indicates that the app has a Java dependency on the Apache HTTP client. Starting in Android 6.0 Marshmallow (API level 23), that client was deprecated and moved out of android.jar into its own org.apache.http.legacy.jar library. As a result, applications that use Apache HTTP client on Android 6.0 or higher will only be able to call the APIs successfully if they declare the use of org.apache.http.legacy via a
<uses-library>
element in AndroidManifest.xml. Otherwise, the API calls will fail with exceptions similar to:Java.Lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/impl/client/DefaultHttpClient
Example: How to solve Missing class: java.lang.ClassValue
R8 : warning : Missing class: java.lang.ClassValue
Solution
โ It is typically safe to suppress this warning:
Add a new text file to the project, named for example proguard-rules.pro.
Set the contents of the file to:
-dontwarn java.lang.ClassValue
Edit the .csproj file in a text editor and add
--pg-conf proguard-rules.pro
to theAndroidR8ExtraArguments
MSBuild property, for example by adding the following lines:\<PropertyGroup\> \<AndroidR8ExtraArguments\>--pg-conf proguard-rules.pro\</AndroidR8ExtraArguments\> \</PropertyGroup\>
๐ (If the project is configured to use R8 for code shrinking, an easier option is to set the Build Action of proguard-rules.pro to ProguardConfiguration in the Visual Studio Properties window, but that approach is not yet supported when using R8 for multidex only.)
Background information
The Missing class: java.lang.ClassValue warning indicates that the app references a library that uses
java.lang.ClassValue
. Typically this happens when the app references a library that was built to run on multiple Java platforms. On Android, thejava.lang.ClassValue
type does not exist in the java.lang package.One known scenario that produces this warning is when an app references the Xamarin.Firebase.Firestore NuGet package, which depends on the cross-platform Google Guava library. Guava uses
java.lang.ClassValue
, but it only uses it on platforms where it is available, so it is safe to suppress the Missing class: java.lang.ClassValue warning for that library.๐ฆ A future version of the Xamarin.Guava.Google NuGet package will provide the
-dontwarn java.lang.ClassValue
R8 rule to suppress the warning automatically. In the mean time, application authors can suppress the warning by adding the rule to their app projects directly.๐ More thorough clean of obj directory between builds
๐ฆ In previous versions, Xamarin.Android reserved a costlier, more complete incremental clean of the intermediate output directory for special scenarios where a NuGet package changed or where the
AndroidPackageNamingPolicy
MSBuild property changed. Xamarin.Android 10.3 expands this behavior to perform the more complete clean for changes to several other MSBuild properties:AndroidAotMode
- ๐ฆ
AndroidCreatePackagePerAbi
AndroidDexTool
AndroidEmbedProfilers
AndroidEnableProfiledAot
AndroidExplicitCrunch
AndroidGenerateJniMarshalMethods
AndroidIncludeDebugSymbols
AndroidLinkMode
AndroidLinkSkip
AndroidLinkTool
AndroidNdkDirectory
- ๐ฆ
AndroidPackageFormat
AndroidSdkBuildToolsVersion
AndroidSdkDirectory
AndroidSequencePointsMode
- โ
AndroidUseLatestPlatformSdk
AndroidUseSharedRuntime
AotAssemblies
BundleAssemblies
EmbedAssembliesIntoApk
JavaSdkDirectory
MonoSymbolArchive
OS
TargetFrameworkVersion
XamarinAndroidVersion
โก๏ธ This should reduce the number of cases where project authors need to run a full clean by hand after changing one of these properties, such as after updating to a new Xamarin.Android version.
๐ Changes to these particular properties already triggered additional build steps, so this new behavior should not noticeably increase incremental build times. As in the past, to get the best incremental build times, avoid changing these properties back and forth too much between builds.
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 theDebugType
MSBuild property in the .csproj file:\<PropertyGroup\> \<DebugType\>embedded\</DebugType\> \</PropertyGroup\>
๐ See the symbol embedding design documentation for more information.
๐ Support for Android App Bundle configuration files
The Android App Bundle publishing format includes an option to customize certain details about how APKs are generated from the bundle, such as whether or not a separate configuration APK is generated for each set of language resources, screen density resources, and ABI libraries. See the documentation about BundleConfig.json files to learn more. Xamarin.Android now includes an option to pass this kind of configuration file to
bundletool
during the build process.To specify a configuration file, set the
AndroidBundleConfigurationFile
MSBuild property to the path of the file. For example, add lines similar to the following to the .csproj file:\<PropertyGroup\> \<AndroidBundleConfigurationFile\>BundleConfig.json\</AndroidBundleConfigurationFile\> \</PropertyGroup\>
Note: Xamarin.Android configures some of the settings automatically, including the list of file extensions to leave uncompressed.
๐ Stream.Seek() for file streams from Android APIs
๐ Until now,
Stream.Seek()
and related properties likeStream.Position
always threwNotSupportedException
onStream
instances returned from Android API methods. In Xamarin.Android 10.3,Stream.Seek()
and the other related properties are now available on theseStream
instances when the underlying Java types inherit fromFileInputStream
.๐ Localized errors and warnings for builds
๐ Many of the errors and warnings in the Xamarin.Android build tasks now provide localized messages that match the region and language settings of the build environment.
Java.Interop nullable reference types compatibility
โก๏ธ The Java.Interop assembly has been updated for compatibility with C# 8.0 nullable reference type checks. Any projects that are using types directly from the Java.Interop assembly can now optionally place that code in a nullable context to take advantage of additional compiler nullability checks. Most Xamarin.Android projects only use the Java.Interop assembly indirectly, so this change is not relevant for most projects.
โก๏ธ Mono.Data.Sqlite SQLite version update
The version of SQLite used by Mono.Data.Sqlite in Xamarin.Android has been updated from 3.28.0 to 3.31.1, bringing in security fixes, improvements, and bug fixes.
โก๏ธ Default Android tools versions update to 29.0
โก๏ธ The default Android SDK Build-Tools version has been updated from 28.0.3 to 29.0.2. This version can be changed per-project if needed via the
AndroidSdkBuildToolsVersion
MSBuild property.โก๏ธ The default Android SDK Platform-Tools version has been updated from 28.0.0 to 29.0.5. This version can be changed per-project if needed via the
AndroidSdkPlatformToolsVersion
MSBuild property.XA1011 error for D8 with ProGuard
Any project using the D8 DEX compiler that has either Code shrinker (
AndroidLinkTool
) set to ProGuard or the olderAndroidEnableProguard
MSBuild property set totrue
will now get an XA1011 build error:error XA1011: Using ProGuard with the D8 DEX compiler is no longer supported. Please update `$(AndroidLinkTool)` to `r8`.
๐ง In the past, this configuration was allowed, but now only the R8 code shrinker is supported for use with the D8 DEX compiler.
To resolve this error, update the Code shrinker setting in the Visual Studio project property pages to r8. This corresponds to the
r8
value for theAndroidLinkTool
MSBuild property in the .csproj file:\<PropertyGroup\> \<AndroidLinkTool\>r8\</AndroidLinkTool\> \</PropertyGroup\>
Note: R8 might in some cases produce new build warnings or errors compared to ProGuard, so the ProGuard rules for the project might require updates after this change.
๐ฆ XA0122 and CS0618 warnings for deprecated Java.Interop.DoNotPackageAttribute
๐ Any app project that references a Xamarin.Android bindings library containing uses of
Java.Interop.DoNotPackageAttribute
will now get a XA0122 build warning:warning XA0122: Assembly 'Library1' is using a deprecated attribute '[assembly: Java.Interop.DoNotPackageAttribute]'. Use a newer version of this NuGet package or notify the library author.
๐ Similarly, any library project that includes a use of
[assembly: Java.Interop.DoNotPackageAttribute]
will now get a CS0618 build warning:warning CS0618: 'DoNotPackageAttribute' is obsolete: 'This attribute is deprecated and will be removed in a future release. Use the @(AndroidExternalJavaLibrary) MSBuild item group instead.'
Java.Interop.DoNotPackageAttribute
will be removed in a future release. NuGet package authors are encouraged to transition away from it at their earliest convenience. The recommended approach is to include the external library as a separate file within the NuGet package and add a .props file in both the build and buildTransitive directories of the NuGet package that sets the library as aAndroidExternalJavaLibrary
item for consuming app projects. For example, if the external library is included alongside the .props file in the build and buildTransitive directories, then the contents of the .props file can be:\<?xml version="1.0" encoding="utf-8"?\> \<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"\> \<ItemGroup\> \<AndroidExternalJavaLibrary Include="$(MSBuildThisFileDirectory)\*.jar"\> \</ItemGroup\> \</Project\>
CS0619 error for obsolete constant fields
โก๏ธ Certain previously deprecated constant fields in the Android API bindings have been updated from
[Obsolete]
to[Obsolete(error:true)]
. These types will now produce CS0619 errors instead of CS0618 warnings.To resolve these errors, switch to the types mentioned in the error messages. For example, for
Android.Content.ComponentCallbacks2.TrimMemoryBackground
, the error message is:error CS0619: 'ComponentCallbacks2.TrimMemoryBackground' is obsolete: 'This constant will be removed in the future version. Use Android.Content.TrimMemory enum directly instead of this field.'
To resolve this example error, switch the type to
Android.Content.TrimMemory.Background
.Bindings projects exclusion of private nested types
๐ฆ Previously, Xamarin.Android bindings projects generated public bindings for all nested Java types, even when the types had private or package-private visibility. Bindings projects now respect private visibilities on nested types and no longer generate bindings for those types.
Note: This change in behavior can result in new C# compiler errors for bindings projects, such as:
error CS0426: The type name 'AttribOp' does not exist in the type 'CSSParser' error CS0115: 'MapControllerOld.HalfCosinusalDeceleratingAnimationRunner.JniPeerMembers': no suitable method found to override
๐ To restore any needed missing types, adjust the visibilities by adding rules similar the following to the Transforms\Metadata.xml file:
\<attr path="/api/package[@name='com.caverock.androidsvg']/class[@name='CSSParser.AttribOp']" name="visibility"\>public\</attr\> \<attr path="/api/package[@name='org.osmdroid.views']/class[@name='MapControllerOld.CosinusalBasedAnimationRunner']" name="visibility"\>public\</attr\>
Removal of AndroidExplicitCrunch feature
๐ In previous Xamarin.Android versions, setting the
AndroidExplicitCrunch
MSBuild property totrue
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 F# Resource.designer.fs file support
F# Xamarin.Android projects now generate Resource.designer.cs files instead of Resource.designer.fs files. The recommended way to consume these files is to the install the Xamarin.Android.FSharp.ResourceProvider NuGet package, which surfaces F# types for the content in the .cs file.
๐ See the DisplayPlatformInfo sample for an example of how to use Xamarin.Android.FSharp.ResourceProvider.
Note: Xamarin.Android.FSharp.ResourceProvider does not support Resource.designer.cs files located in the intermediate output directory, so generation of resource designer files in the intermediate output directory is now disabled for F# projects.
๐ Removal of keystore certificate fingerprint from build output
๐ The performance improvement from GitHub PR 4308 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.๐ Removal of .exe reference support
To improve performance, Xamarin.Android no longer probes for .exe files during app startup.
Projects must now use .dll assemblies for all dependencies. Compatible dependency types include .NET Standard libraries, Xamarin.Android class libraries, Xamarin.Android binding libraries, shared projects, and portable class libraries.
Background information
The Xamarin.Android build process has historically used .dll files by default, so this change should only affect dependencies built using other project types or custom build targets.
Also, the build process has intentionally skipped .exe files when packaging APKs since as far back as Xamarin.Android 9.4, so this new Xamarin.Android 10.3 behavior at run time is unlikely to affect app behavior for project authors upgrading from Xamarin.Android 9.4 or above.
๐ Issues fixed in Xamarin.Android 10.3.1.0
๐ 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.
- ๐ Developer Community 888836: ADB1000: Deployment failed System.ArgumentOutOfRangeException ... Parameter name: length could prevent successful deployment on certain devices.
- Developer Community 917114: error MSB4018: The "CreateManagedLibraryResourceArchive" task failed unexpectedly ... System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. caused builds to abort for Xamarin.Android class library projects that included
AndroidAsset
items with paths outside of the project directory. - ๐ GitHub 2654: Directory obj\Release\android\assets contains *.dll but no debug symbols file was found. warnings were shown by default in Release configuration builds for apps that referenced libraries without debug symbols. These warnings were often caused by NuGet packages and so could not be resolved by app project authors. These warnings have been demoted to informational messages for now.
- ๐ GitHub 3636: Error inflating class android.support.v7.widget.FitWindowsLinearLayout ---> Java.Lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.FitWindowsLinearLayout" and similar errors could prevent apps built with Code shrinker set to ProGuard or r8 from running successfully unless custom ProGuard rules were added to the project by hand. In Xamarin.Android 10.3, projects configured to use AAPT2 now pass the
--proguard
option to AAPT2 to generate default ProGuard rules that more closely match the defaults for Android Studio projects, removing the need to add custom rules for common scenarios like theFitWindowsLinearLayout
type from the Android Support Library. - ๐ง GitHub 3813: Xamarin.Android did not yet support Android App Bundle configuration files.
- GitHub PR 4149: The managed linker did not yet consider the
Java.Interop.GenericMarshaler
namespace for linking when set to link SDK assemblies only. - ๐ GitHub PR 4214: The
ConvertResourcesCases
task could leave behind a file in the user's temporary directory after the build. - 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. - GitHub 4409: ; expected prevented using comma-delimited lists in
Aliases
MSBuild item metadata on Xamarin.Android library project references. - GitHub PR 4422: error APT0001: unknown option... was inaccurate for cases where an option was misspelled, and it did not yet mention the relevant MSBuild properties.
- GitHub PR 4444: System.IO.IOException: The directory is not empty could sometimes prevent the
RemoveDirFixed
task from removing temporary build directories. The task now produces a warning instead, allowing the build to complete successfully. - GitHub 4478, GitHub 4486: On macOS, starting in Xamarin.Android 10.2, [INSTALL_FAILED_INVALID_APK: ... base.apk code is missing] and Module 'base' has no dex files prevented deploying successfully for certain projects configured to use the DX DEX compiler.
Application behavior on device and emulator
- GitHub 4110: Unable to get provider mono.MonoRuntimeProvider_1: java.lang.ClassNotFoundException prevented apps containing broadcast receivers from launching successfully if they were built with ProGuard or R8 enabled.
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.
- 0๏ธโฃ Mono GitHub 18917: Explicit implementations of interface properties were ignored if the interfaces provided default implementations.
๐ Design-time build
- โก๏ธ GitHub 2413: The
_ManagedUpdateAndroidResgen
target was running during every incremental design-time build.
Bindings projects
- ๐ GitHub PR 4385: You have Jar libraries, lint.jar, lint.jar, ... that have the identical name with inconsistent file contents could prevent apps from using custom bindings libraries for certain Java libraries. This was discovered while preparing new versions of the Xamarin.AndroidX bindings libraries.
- Java.Interop GitHub 519: error CS1001: Identifier expected prevented building binding projects for Java libraries that defined classes outside of a Java package.
- Java.Interop GitHub 565: error CS0103: The name 'p0' does not exist in the current context prevented building bindings projects for Java libraries that contained explicit interface property implementations.
- Java.Interop GitHub 571: Kotlin: Hiding internal ... method caused missing bindings for public Kotlin methods in cases where the method names were the same as the names of private properties or fields.
- ๐ฆ Java.Interop GitHub 572: Package-private nested types were not automatically excluded from bindings, resulting in errors similar to error: ... is not public in ...; cannot be accessed from outside package when attempting to use the bindings.
Thank you
A big _ Thank You! _ to community members who contributed improvements in this release:
- Andrey Kurdyumov (@kant2002), GitHub PR 3848: Use HTTPS protocol instead of Git protocol for xamarin-android repository submodules that were using the Git protocol.
- ๐ง @mathieubourgeois, GitHub PR 3915: Add support for Android App Bundle configuration files.
- ๐ Bruno Garcia (@bruno-garcia), GitHub PR 4004: Remove an unused libzip dependency from the xamarin-android source build.
- giga bokuchava (@mister-giga), GitHub PR 4120: Experiment with providing an implicit operator to allow assigning
Android.Graphics.Color
instances fromint
literals. - ๐ Christopher Atlan (@catlan), GitHub PR 4197: Add implementations of
Stream.Seek()
and other related properties forStream
instances from Android APIs where the original Java return types inherit fromFileInputStream
.
Installing
โก๏ธ To get the new version in Visual Studio, update Visual Studio:
- Visual Studio 2019 version 16.6 โ Visual Studio Installer
- Visual Studio 2019 for Mac version 8.6 โ Visual Studio for Mac Installer with the Stable updater channel
For other scenarios, the latest commercial .vsix and .pkg installer packages can be found in the project README.
๐ Versions for continuous build environments
๐ For users installing Xamarin.Android on macOS continuous build environments, the corresponding version of the Mono Framework MDK to use is Mono Framework MDK 6.10.0.104.
For special scenarios where users require Xamarin.Android SDK version 10.3.1.0 without any subsequent 10.3 servicing fixes, the fixed-version Visual Studio 2019 version 16.6.0 BuildTools installer can be used on Windows, and the fixed-version .pkg installer package can be used on macOS. The fixed-version .vsix installer package is another alternative for Windows.
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 #66.
- 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.