Xamarin v11.1.0.3 Release Notes

Release Date: 2020-09-14 // over 3 years ago
  • September 14, 2020 โ€” Xamarin.Android 11.1.0.3 was published as part of Visual Studio 2019 version 16.8 Preview 3 and Visual Studio 2019 for Mac version 8.8 Preview 3.

    ๐Ÿš€ Corresponding Visual Studio 2019 Preview release notes

    What's new

    0๏ธโƒฃ android:extractNativeLibs set to "true" by default

    ๐Ÿš€ Starting in Xamarin.Android 11.0, projects that had references to the Xamarin.AndroidX NuGet packages or that were otherwise configured to use the improved manifest merging option would get a value of "false" by default for the android:extractNativeLibs Android manifest attribute due to changes in the latest version of the manifest merger tool from Google. Because this value had previously been "true" when left blank, this could cause unexpected behavior changes for Xamarin.Android applications. Xamarin.Android now now sets this attribute it to "true" by default even when using the improved manifest merging.

    ๐Ÿ“š According to the Android documentation, extractNativeLibs affects APK size and install size:

    ๐Ÿ“ฆ > Whether or not the package installer extracts native libraries from the APK to the filesystem. If set to false, then your native libraries must be page aligned and stored uncompressed in the APK. No code changes are required as the linker loads the libraries directly from the APK at runtime.

    This is a tradeoff that each developer should decide upon on a per-application basis. Is a smaller install size at the cost of a larger download size preferred?

    Xamarin.Android now emits android:extractNativeLibs="true" by default, preferring smaller APK sizes. You can get the opposite behavior with an AndroidManifest.xml such as:

    \<?xml version="1.0" encoding="utf-8"?\> \<manifest xmlns:android="http://schemas.android.com/apk/res/android"android:versionCode="1" android:versionName="1.0" package="com.companyname.hello"\> \<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="30" /\> \<application android:label="Hello" android:extractNativeLibs="false" /\> \</manifest\>
    

    ๐Ÿ— apksigner from Android SDK Build-Tools 30.0.3 now included

    ๐Ÿ— Xamarin.Android now packages its own copy of the apksigner executable. The current included version is aligned with Android SDK Build-Tools 30.0.3.

    ๐Ÿš€ Attempting to use the upstream apksigner that's packaged in Android SDK Build-Tools 30.0 from the Android SDK Manager with Java JDK 8 results in the following error, as mentioned in the Xamarin.Android 11.0 release notes:

    java.lang.UnsupportedClassVersionError: com/android/apksigner/ApkSignerTool has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
    

    ๐Ÿ— The new apksigner that is now included as part of Xamarin.Android matches the source version of the upstream tool but is built against Java JDK 8 so that Xamarin.Android can now use Android SDK Build-Tools 30.0 alongside Java JDK 8.

    ๐Ÿ›  Issues fixed

    ๐Ÿš€ Application and library build and deployment

    Developer Community 1144021 and GitHub 4990: Starting in Xamarin.Android 11.0, ADB0010: [INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2] build error could prevent apps from being deployed after AndroidManifest.xml changes.

    Developer Community 1157593: Modifications to files set to use the AndroidAsset Build Action were not included as expected in incremental builds. Clean rebuilds were required to propagate the changes as expected.

    GitHub 1597: Marshaling of java.util.Map instances in files set to use the AndroidInterfaceDescription Build Action was incorrect.

    โšก๏ธ GitHub 4986: Updates to Android tooling (manifest-merger), caused //application/@android:extractNativeLibs to be set to "false" by default. This could cause an undesirable APK file size increase that was more noticeable for Xamarin.Android applications using AOT. Xamarin.Android now sets extractNativeLibs to "true" by default.

    GitHub 4996: On Android 11 devices and emulators, Mono.AndroidTools.AdbException: secure_mkdirs failed: Permission denied could prevent deployment in the Debug configuration.

    GitHub 4998: Files under lib/ must have .so extension, found 'lib/x86/gdbserver'. build error prevented building app bundles for projects with references to Android C++ library projects.

    ๐Ÿ‘ GitHub 5024: error XA0119: Using the shared runtime and Android App Bundles at the same time is not currently supported build error could mistakenly appear for Xamarin.Android class libraries when the AndroidPackageFormat MSBuild property was set to aab.

    GitHub PR 5038: Errors similar to error APT2260: resource drawable/icon (aka com.contoso.androidapp:drawable/icon) not found could prevent building projects that were using ResizetizerNT and google-services.json together. The build system has now been updated to ensure each resource directory has its own unique cache file.

    ๐Ÿ”‹ GitHub 5049: Starting in Visual Studio 2019 version 16.7, build errors similar to Feature 'XYZ' is not available in C# 7.3. Please use language version 8.0 or greater. could prevent projects from using C# 8.0 language features.

    Application behavior on device and emulator

    • GitHub 4989: Calling this.Dispose() from within a Java.Lang.Object.Dispose(bool) override threw a System.ArgumentException.

    Bindings projects

    Java.Interop GitHub 694: Kotlin synthetic constructors were not yet ignored, resulting in unactionable error messages such as:

    Error while processing '[Constructor] MaterialDialog(android.content.Context p0, com.afollestad.materialdialogs.DialogBehavior p1, int p2, kotlin.jvm.internal.DefaultConstructorMarker p3)' in '[Class] com.afollestad.materialdialogs.MaterialDialog': Type 'kotlin.jvm.internal.DefaultConstructorMarker' was not found.
    

    Installing

    โšก๏ธ To get the new version in Visual Studio, update Visual Studio:

    For other scenarios, the latest commercial .vsix and .pkg installer packages can be found in the project README.

    Open source

    Xamarin.Android 11.1 is based on the open-source Xamarin.Android repositories: