Skip to content

Releases: dotnet/android

Xamarin.Android 9.3.0.19

08 May 00:47

Choose a tag to compare

Pre-release

Xamarin.Android 9.3.0.19 was released as part of Visual Studio 2019 version 16.1 Preview 3 and to the Preview updater channel of Visual Studio 2019 for Mac.

Issues fixed

Application Mono Framework behavior on device and emulator

This version of Xamarin.Android updates the Mono 5.18 runtime and class libraries from Commit bf4e8d2a to Commit 3f5ec6d9, adding 1 new commit:

  • Mono GitHub 13878: For Xamarin.Mac, certain JIT features were not yet compatible with new macOS security features. This commit is not important for Xamarin.Android itself. It is included in this release to keep the Mono commit aligned with Xamarin.Mac and Xamarin.iOS.

Design-time build process

  • GitHub PR 2991: Starting in Visual Studio 2019 version 16.1 Preview 2, design-time features such as IntelliSense could fail in certain cases if a referenced library included an empty Android resources directory.

Xamarin.Android SDK installation

  • GitHub PR 2959: Starting in Visual Studio 2019 version 16.1 Preview 2, Xamarin.Android included a number of unneeded temporary files left over from the installer package build process. The installer package for Xamarin.Android 9.3.0.19 no longer includes those unneeded files.

OSS core

The commercial build for this version is based on the bundle from the open-source xamarin-android-d16-1 build #25.

Xamarin.Android 9.2.3.0

18 Apr 18:56

Choose a tag to compare

Xamarin.Android 9.2.3.0 was released to the Stable updater channel of Visual Studio 2019 for Mac.

Update April 30, 2019: Xamarin.Android 9.2.3.0 is now also available as part of Visual Studio 2019 version 16.0.3. The difference in publication date was due to a few coincidences with the timing of this particular release.

Issues fixed

Application Mono Framework behavior on device and emulator

This version of Xamarin.Android updates the Mono 5.18 runtime and class libraries from Commit 5ad371da to Commit 5ac37ccd, adding 2 new commits:

  • Developer Community 435502, Developer Community 515603, GitHub 2920: Xamarin.Android apps would crash during debugging when they called certain APIs. Applications affected by this issue would run successfully if launched without the debugger attached, but when launched with the debugger attached, the applications would exit unexpectedly after one of the problematic APIs was called. The debug output would show a "Fatal signal 11 (SIGSEGV)" after the crash.
  • Mono GitHub 13610: Xamarin.Android projects in which users had explicitly set a value for the undocumented, experimental $(AndroidAotMode) MSBuild property could hit a problem where methods that returned Task objects or generic types would lead to incorrect return values. This is not expected to be an issue for any current Xamarin.Android projects. The fix is included in this release to keep the Mono commit aligned with Xamarin.iOS.

OSS core

The commercial build for this version is based on the bundle from the open-source xamarin-android-d16-0 build #36.

Xamarin.Android 9.3.0.14

23 Apr 22:14

Choose a tag to compare

Pre-release

Xamarin.Android 9.3.0.14 was released as part of Visual Studio 2019 version 16.1 Preview 2 and Visual Studio 2019 for Mac.

What's new

Build and deployment performance

  • GitHub PR 2554: Skip the _SetLatestTargetFrameworkVersionForPackageReference MSBuild during NuGet restore unless $(AndroidUseLatestPlatformSdk) is true. This saved roughly 600 milliseconds for NuGet restore on a test project that used an explicit $(TargetFrameworkVersion) with $(AndroidUseLatestPlatformSdk) set to false.
  • GitHub PR 2561: Remove the old _RegisterAndroidFilesWithFileWrites target that is no longer needed. This trimmed about 80 milliseconds off the build time of a test project.
  • Java.Interop GitHub PR 405, GitHub PR 2576: Change some LINQ expressions to loops and remove some redundant assembly metadata retrieval steps. This reduced the time for the GenerateJavaStubs task in a test project from approximately 1414 milliseconds to 1355 milliseconds.
  • GitHub PR 2589: Change a few uses of temporary on-disk files to work all in memory instead.
  • GitHub PR 2612: Switch the ResolveAssemblies task to use System.Reflection.Metadata instead of Mono.Cecil. This reduced the time for the ResolveAssemblies task in a test project from about 320 milliseconds to about 110 milliseconds.
  • GitHub PR 2624: Switch the GetAdditionalResourcesFromAssemblies task to use System.Reflection.Metadata instead of Mono.Cecil. This reduced the time for the GetAdditionalResourcesFromAssemblies task in a test project from about 100 milliseconds to about 50 milliseconds.
  • GitHub PR 2626: Exclude the Build target from being a dependency of the SignAndroidPackage when building inside the IDE. This reduced the time to re-launch an unchanged test application from roughly 6.5 seconds to roughly 4.5 seconds.
  • GitHub PR 2643: Skip over .NET Standard (and Portable Class Library) projects in the GenerateJavaStubs task because those project types never need to interact with Java. This reduced the total time for the GenerateJavaStubs task from about 1 second to 870 milliseconds for incremental builds of a test Xamarin.Forms project. Projects that use more .NET Standard libraries could see a more noticeable time savings.

App startup performance

Java.Interop GitHub PR 416, GitHub PR 2716: Change the JNI runtime interop initialization to happen lazily, allowing the app to skip some parts during startup. This reduced the time for this initialization step from roughly 225 milliseconds to 216 milliseconds for a test application on a Pixel 2 XL device.

Android NDK r19 compatibility

Xamarin.Android version 9.3 adds compatibility for running clang rather than gcc for the Bundle assemblies into native code and AOT Compilation build options. This allows Xamarin.Android to use Android NDK version r18 and above, where GCC has been removed.

The native libraries that are part of Xamarin.Android are now also built against Android NDK r19. The updated Android NDK toolchain means that it is now recommended to use Xamarin.Android apps only with devices running Android 4.1 (API level 16) or higher. Warning XA4216 has been updated accordingly to help highlight this change for any projects that might still have an older version set for the minSdkVersion in the AndroidManifest.xml file.

Easier way to use android:extractNativeLibs="false"

Xamarin.Android 9.2 added support for the android:extractNativeLibs="false" setting, but enabling it required several manual steps. Xamarin.Android 9.3, makes this feature easier to work with by trimming down the number of steps to just one:

  • Add the android:extractNativeLibs="false" attribute to the <application/> element in the Properties\AndroidManifest.xml file

arm64-v8a architecture enabled by default

Starting August 1, 2019, Google Play will require all new apps and app updates that include native code to provide 64-bit versions in addition to 32-bit versions. To align with this upcoming requirement, Xamarin.Android version 9.3 now includes both armeabi-v7a and arm64-v8a in the default value of the $(AndroidSupportedAbis) MSBuild property. This change will only affect existing build configurations if the property is blank for that configuration in the .csproj file. The change will not affect build customized configurations where the property already includes an architecture other than armeabi-v7a.

R8 version update to 1.3.52

The version of the R8 code shrinker included in Xamarin.Android has been updated from 1.2.52 to 1.3.52.

Mono.Data.Sqlite SQLite version update

The version of SQLite used by Mono.Data.Sqlite in Xamarin.Android has been updated from 3.26.0 to 3.27.1, bringing in several improvements and bug fixes.

OpenTK version 0.9.9.3 warning

As mentioned in the previous release notes, the assembly for OpenTK version 0.9.9.3 will be removed from Xamarin.Android in an upcoming release. To help prepare for this removal, Xamarin.Android 9.3 now provides a build warning for any project referencing OpenTK version 0.9.9.3:

warning XA1009: OpenTK 0.9.3 is Obsolete. Please upgrade to OpenTK 1.0

To resolve this warning in Visual Studio, ensure the selected reference for OpenTK is:

Visual Studio Reference Manager with OpenTK version 1.0.0.0 selected

And in Visual Studio for Mac, ensure the selected reference is:

Visual Studio for Mac Edit References window with OpenTK version 1.0.0.0 selected

Issues fixed

Application and library build process

  • Developer Community 330758: Projects that had indirect dependencies on version 4.3.0 of the System.Runtime.Loader NuGet package would fail to build with "XA0009: Error while loading assembly ... BadImageFormatException". Xamarin.Android 9.3 allows these projects to build without error. As a caution, the System.Runtime.Loader.AssemblyLoadContext class in Xamarin.Android currently only provides empty implementations, so although certain APIs from NuGet packages that depend on the System.Runtime.Loader NuGet package will work already, features that specifically depend on AssemblyLoadContext will encounter NotImplementedException errors.
  • Developer Community 346386: Attempting to cancel a build during the AOT Compilation step would only stop the build after the AOT step completed. In Xamarin.Android 9.3, canceling the build during the AOT step now aborts the step as expected.
  • Developer Community 514955: Starting in Visual Studio 2019 for Mac, the References list in the Solution pad and the Edit References window showed error icons and missing entries for most of the base class libraries in Xamarin.Android projects.
  • GitHub 1768: The build process did not yet provide warnings to guide projects toward the recommended best practice of keeping minSdkVersion less than or equal to targetSdkVersion and targetSdkVersion equal to compileSdkVersion.
  • [GitHub PR 2349](https://github.com/xamarin/xamarin-android/pull/...
Read more

Xamarin.Android 9.2.0.5

19 Mar 20:48

Choose a tag to compare

Xamarin.Android 9.2.0.5 was released as part of Visual Studio 2019 RC.3 and Visual Studio 2019 Preview 4.3.

Issues Fixed

Design-Time Build Process

  • GitHub PR 2803: The Xamarin.Forms previewer could show a blank page labeled "AndroidFormsPreviewerRenderer" for XAML files in certain projects until the projects were built. The previewer can now render the XAML files in those projects successfully without requiring the projects to be built.

Xamarin.Android 9.2.0.4

12 Mar 20:24

Choose a tag to compare

Xamarin.Android 9.2.0.4 was released as part of Visual Studio 2019 RC.2 and Visual Studio 2019 Preview 4.2.

Issues Fixed

Application Behavior on Device and Emulator

  • Developer Community 442312, GitHub 2679: Attempting to call new X509Certificate(bytes) could fail with "System.PlatformNotSupportedException: Cannot get `ISystemDependencyProvider`." on device or emulator.

Xamarin.Android 9.2.0.3

05 Mar 22:59

Choose a tag to compare

Xamarin.Android 9.2.0.3 was released to the Xamarin Preview updater channel of Visual Studio 2019 for Mac Preview.

Issues Fixed

Application Mono Framework Behavior on Device and Emulator

This version of Xamarin.Android updates the Mono 5.18 runtime and class libraries from Commit 163f45d8 to Commit 5ad371da, adding 1 new commit:

  • GitHub PR 13106: Make System.dll internals visible to Mono.Android. This is a first step toward resolving the known issue GitHub 2679. Note that the issue is not yet resolved in Xamarin.Android 9.2.0.3 because the corresponding change to take advantage of the new visibility of the System.dll internals is not yet in place.

Known Issues

  • GitHub 2679: Attempting to call new X509Certificate(bytes) can fail with "System.PlatformNotSupportedException: Cannot get `ISystemDependencyProvider`." on device or emulator. This issue depends on the order of type instantiations and method calls.

    Workaround: Invoke the non-public Mono.SystemDependencyProvider.Initialize() method at some point in your app before the first use of X509Certificate. One option is to use reflection to locate and invoke the method:

    var t = Type.GetType("Mono.SystemDependencyProvider, System", throwOnError: true);
    var m = t.GetMethod("Initialize", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
    m.Invoke(null, null);

    Another approach is to use some part of the public API surface that invokes the method behind the scenes. For example, the following line is sufficient:

    new X509Certificate2(new X509Certificate());

Xamarin.Android 9.2.0.1

27 Feb 21:57

Choose a tag to compare

Xamarin.Android 9.2.0.1 was released as part of Visual Studio 2019 RC and Visual Studio 2019 Preview 4.

Issues Fixed

Application and Library Build Process

  • Developer Community 437807, GitHub 2685: Starting in the earlier Visual Studio 2019 Previews, builds could fail with "error MSB6006: "java.exe" exited with code 1." if project paths contained non-ASCII characters.

  • GitHub 2652: Starting in the earlier Visual Studio 2019 Previews, projects with AOT enabled would fail to build with "error XA5101: Missing Android NDK toolchains directory" unless the project also explicitly set the NDK path via the $(AndroidNdkDirectory) MSBuild property. Now the build will automatically locate the NDK if it is present in the ndk-bundle subdirectory of the Android SDK directory.

  • GitHub 2692: The build tasks and targets did not yet provide a warning for projects that have the minimum Android version set lower than Android 2.3 (API level 9). This warning is needed because the native parts of Xamarin.Android are built against Android NDK r14, so Xamarin.Android apps might not work correctly on devices running Android versions older than Android 2.3 (API level 9).

  • GitHub 2708: Starting in the earlier Visual Studio 2019 Previews, projects that used either Bundle assemblies into native code or AOT Compilation (Experimental) and did not explicitly set the NDK path via the $(AndroidNdkDirectory) MSBuild property would fail to build with two different error messages, neither of which mentioned how to resolve the error. Both scenarios now produce the same error, and the error mentions how to resolve the error by installing the NDK or setting the MSBuild property.

  • GitHub PR 2724: Starting in Visual Studio 2019 Preview 3, apps could encounter exceptions if they used AppDomain.GetAssemblies(). Xamarin.Forms apps that used CSS style sheets and did not have XAML Compilation enabled were one example. In Xamarin.Android 9.2.0.1, these apps will once again automatically preload all assemblies during startup, preventing the exceptions. Note that preloading the assemblies does increase startup time. Future versions of Xamarin.Forms will no longer require the preload step for any scenarios. If your app is already compatible with skipping the preload step, you can re-enable the performance improvement by setting the $(AndroidEnablePreloadAssemblies) MSBuild property to false in your .csproj file:

    <PropertyGroup>
        <AndroidEnablePreloadAssemblies>false</AndroidEnablePreloadAssemblies>
    </PropertyGroup>

Application Mono Framework Behavior on Device and Emulator

This version of Xamarin.Android updates the Mono 5.18 runtime and class libraries from Commit 725ba2a2 to Commit 163f45d8, adding 10 new commits.

A few improvements and issues fixed relevant to Xamarin.Android are:

  • GitHub PR 12058: Disable probing the AOT cache on Android, where it is unnecessary. This saves time during application startup.
  • GitHub 12538: Applications could sometimes hit an exception during startup due to a race condition.
  • GitHub 12688: StackTrace.GetFrames() was returning redundant additional frames for async methods.

Known Issues

  • GitHub 2679: Attempting to call new X509Certificate(bytes) can fail with "System.PlatformNotSupportedException: Cannot get `ISystemDependencyProvider`." on device or emulator. This issue depends on the order of type instantiations and method calls.

    Workaround: Invoke the non-public Mono.SystemDependencyProvider.Initialize() method at some point in your app before the first use of X509Certificate. One option is to use reflection to locate and invoke the method:

    var t = Type.GetType("Mono.SystemDependencyProvider, System", throwOnError: true);
    var m = t.GetMethod("Initialize", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
    m.Invoke(null, null);

    Another approach is to use some part of the public API surface that invokes the method behind the scenes. For example, the following line is sufficient:

    new X509Certificate2(new X509Certificate());

Xamarin.Android 9.1.8.0

14 Feb 05:04

Choose a tag to compare

Xamarin.Android 9.1.8.0 was released to the Visual Studio 2017 for Mac version 7.7 updater channels.

This version of Xamarin.Android updates the Mono 5.14 runtime and class libraries from Commit 62031dca to Commit b5381878, adding 2 new commits. This aligns Xamarin.Android to the Mono commit used by the matching releases of Xamarin.iOS and Xamarin.Mac.

Xamarin.Android 9.1.7.0

12 Feb 20:29

Choose a tag to compare

Xamarin.Android 9.1.7.0 was released as part of Visual Studio 2017 version 15.9.7.

Issues Fixed

  • Developer Community 379758, Mono Framework GitHub 10488: HttpWebRequest was sometimes leaving exceptions unobserved in its internal Task objects, resulting in uncatchable exceptions that in turn caused noisy invocations of any event handlers subscribed to the TaskScheduler.UnobservedTaskException event.

Xamarin.Android 9.1.103.12

13 Feb 22:14

Choose a tag to compare

Pre-release

Xamarin.Android 9.1.103.12 was released as part of Visual Studio 2019 Preview 3.

What's New

Temporary Breakage for Apps That Use AppDomain.GetAssemblies(), Including Xamarin.Forms Apps with CSS

Due to an application startup performance improvement that stops preloading all assemblies during startup, the behavior of AppDomain.GetAssemblies() has changed in this preview. This will become an opt-in behavior in the next Xamarin.Android 9.2 preview, but in Xamarin.Android 9.1.103.12, there is not yet a way to prevent the new behavior, so this change will disrupt applications that rely on the old behavior.

C# code using System.Reflection and AppDomain.GetAssemblies() may be affected such as:

  • Dependency injection libraries
  • Certain Xamarin.Forms features
  • Potentially other mobile frameworks (MVVM, etc.) that leverage System.Reflection

A workaround to explicitly call Assembly.Load() at startup may be needed.

Xamarin.Forms apps that use CSS style sheets are one important scenario affected by this change:

  • Xamarin.Forms GitHub 5164: Xamarin.Forms apps that use CSS style sheets and do not have XAML Compilation enabled fail with a NullReferenceException at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.ProvideValue() during application startup on device or emulator.

    Temporary workaround: Add a call to System.Reflection.Assembly.Load("Xamarin.Forms.Xaml") as the first statement in the Activity.OnCreate(Bundle bundle) override in the Android app project:

    // In your MainActivity.cs, or first activity
    protected override void OnCreate(Bundle bundle)
    {
        // Workaround, to manually load Xamarin.Forms.Xaml before Xamarin.Forms startup
        Assembly.Load("Xamarin.Forms.Xaml");
    
        base.OnCreate(bundle);
    
        global::Xamarin.Forms.Forms.Init(this, bundle);
        LoadApplication(new App());
    }

    This workaround will no longer be necessary in the next Xamarin.Android 9.2 preview version.

App Startup Performance Improvements

GitHub PR 2515: Optimize several application startup operations:

  • Reduce Java class lookup.
  • Don't lookup android.os.Build.VERSION.SDK_INT via JNI.
  • jstring handling improvements.
  • Review logging messages.
  • Improve package name hash generation.
  • Improve environment variable processing.
  • Stop preloading all assemblies.
  • Avoid using "system properties" to control Mono features.
  • Desktop version is now a compile-time build option, not runtime.
  • Initialize xamarin_getifaddrs() on-demand, not at startup.

These optimizations reduced the average startup time for a test application from 0.7 seconds to 0.3 seconds in the Release configuration and from 1.4 seconds to 1.1 seconds in the Debug configuration.

Mono.Data.Sqlite SQLite Version Update to 3.26.0

The version of SQLite used by Mono.Data.Sqlite in Xamarin.Android has been updated to 3.26.0, bringing in additional improvements and bug fixes compared to the Xamarin.Android 9.2 preview.

Incompatibility with Minimum Android Versions below Android 2.3 (API level 9)

Xamarin.Android projects configured to use a minimum Android version below Android 2.3 (API level 9) will fail to build with the following error:

error: method init in class Runtime cannot be applied to given types;
				Runtime.init (
  required: String,String[],String,String[],ClassLoader,String[],String[],String,int,String[]
  found: String,String[],String,String[],ClassLoader,String[],String[],String
  reason: actual and formal argument lists differ in length

The recommended way to resolve this error is to update the minimum API level to Android 2.3 (API level 9) or higher. This value can be found in the project properties under Android Manifest > Minimum Android version in Visual Studio and under Android Application > Minimum Android version in Visual Studio for Mac.

The error appears because the app startup performance improvements in this release expose an obsolete code path for these older API levels.

Issues Fixed

Application and Library Build Process

Application Behavior on Device and Emulator

  • GitHub 1673: Attempting to run large APKs on device or emulator could fail on startup if the size of the APK exceeded the largest available contiguous block of free memory. In Xamarin.Android 9.2, the app startup process now calls mmap() separately for individual files from the APK instead of once for the whole APK. This allows larger APKs to run successfully.
  • GitHub 2081: Applications with the android:directBootAware attribute set to true for the whole application or for an activity, content provider, broadcast receiver, or service would quit unexpectedly when attempting to launch on a freshly rebooted, locked device running Android 7.0 Nougat or higher.

Application Mono Framework Behavior on Device and Emulator

This version of Xamarin.Android updates the Mono 5.18 runtime and class libraries from Commit 23f2024a to Commit 725ba2a2, adding 29 new commits.

A couple changes relevant to Xamarin.Android are:

  • GitHub PR 11828: Fix race condition in XmlCharType.Instance
  • GitHub PR 12410: Fix debugger crash when there is a generic struct with a field that is an enumerator

Design-Time Build Process

  • GitHub 2548: In Visual Studio 2019 Preview 2, the _ResolveAssemblies build target could fail during design-time builds triggered by the Android designer, leading to errors in the Android designer.
  • GitHub PR 2607: In Visual Studio 2019 Preview 2, the ResolveLibraryProjectImports task was not always returning full paths for the output items. This could cause errors when working with the Android designer.