Skip to content

Releases: dotnet/android

Xamarin.Android 11.2.99.192 [11.3 Preview]

21 Apr 23:50
a9a7190
Compare
Choose a tag to compare

Application build and deployment

  • Developer Community 1288717:
    Support Fast Deployment for System Applications.
    Added support for fast deployment while building system based
    applications. Applications developed in this mode need to be
    signed with a platform key and set
    /manifest/@android:sharedUserId
    to android.uid.system within AndroidManifest.xml:

            <manifest xmlns:android="http://schemas.android.com/apk/res/android"
                android:sharedUserId="android.uid.system"
                …>
            </manifest>
  • Developer Community 1363149:
    System.ArgumentException when %PATH% or %PATHEXT% contain ".

  • GitHub PR 5304:
    Add support for producing a ProGuard mapping.txt file to the build system.
    This file can be used by users to remove this warning:

    "This App Bundle contains Java/Kotlin code, which might be obfuscated."
    

    ... when uploading packages to the Google Play Store.

    In order to opt-in to this behavior, set the AndroidProguardMappingFile
    MSBuild property in your project file to the path of the file you want
    generated:

    <PropertyGroup>
      <AndroidProguardMappingFile>$(OutputPath)\mapping.txt</AndroidProguardMappingFile>
    </PropertyGroup>
  • GitHub PR 5327:
    Allow users to specify additional app bundle "modules" when
    building using $(AndroidPackageFormat) set to aab.

  • GitHub Issue 5562:
    Fix NullReferenceException from <LinkAssembliesNoShrink/> task.

  • GitHub Issue 5627:
    Allow multiple r-classes.jar files to be included in a build.

  • GitHub Issue 5633:
    Support $(AndroidUseInterpreter) under .NET 6.

  • GitHub Issue 5710:
    Command too long error when deploying an app with lots of localization assemblies.

  • GitHub Issue 5723:
    BuildVersionCodes.R had the wrong value.

  • GitHub Issue 5751:
    On .NET 6, the default value for $(SuppressTrimAnalysisWarnings) is True.

  • GitHub PR 5726:
    An external contribution by @mfranke-moba,
    which adds support for out and inout array parameters in AIDL files.
    Fixes GitHub Issue 4717
    and GitHub Issue 5079.

Preview bindings for Android 12 Developer Preview 2

This version includes preview bindings for the
second Developer Preview of Android 12 from Google.
See the Android 12 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 the
$(TargetFrameworkVersion) to v11.0.99 in the .csproj file:

<TargetFrameworkVersion>v11.0.99</TargetFrameworkVersion>

Binding project build

Notable issues fixed

Xamarin.Android 11.2.2.1

21 Apr 23:48
877f572
Compare
Choose a tag to compare

Installing

What's new in Xamarin.Android 11.2

Xamarin.Android 11.2 releases

Corresponding Visual Studio 2019 Preview release notes

March 2, 2021 — Xamarin.Android 11.2.0.21

This version is included in Visual Studio 2019 version 16.9 and Visual Studio 2019 for Mac version 8.9.

In Xamarin.Android 11.2.0.21

Rewritten fast deployment system

The Fast Deployment system has been fully rewritten to improve reliability and performance.

The new system also no longer uses the external drive for the fast deployment files.
All of the files and tooling are now stored in the application's internal directory.
This has an advantage in that when the application is uninstalled, all of the files and
the tooling will be removed as well.

The new system will not work on any devices older than Android 5.0 Lollipop (API level 21),
as it relies on features that only work Android 5.0 and later.

To debug an app running Android older than Android 5.0, disable Fast Deployment
by setting the $(EmbedAssembliesIntoApk) property to False.

See the Fast Deployment documentation for more details.

Known Issue: Fast Deployment and .mdb files

The new Fast Deployment mechanism may fail with:

error : Could not find file "…/<somefile>dll.mdb"

See also: #5631

The issue here is that we are trying to fast deploy a file that does not
exist. This is normally only caused when referencing an old NuGet package
or Project which is still using the old Pdb format for debug symbols.
This old format has to be converted into the Mdb format in order for those
debug symbols to be used by the runtime. The new Portable Pdb
format is fully supported.

The work around is to upgrade the nuget package to a newer version which
is hopefully now using the Portable format. If it is for a Project
reference you manage, then try changing the DebugType to be portable.

If none of that is an option, you can try adding the following to your
application csproj.

<Target Name="_RemoveMdbFiles" BeforeTargets="_Upload">
    <ItemGroup>
        <_ResolvedSymbols Remove="**/*.dll.mdb" />
    </ItemGroup>
</Target>

Application and library build and deployment

  • Developer Community 1036602, GitHub Issue 5009: Starting in Xamarin.Android 10.2, .pdb files were not included in the APK if the managed linker was enabled.

  • Developer Community 1184573: Xamarin Android falsely saying that Resource does not exist in the current context (CS0103). Duplicate attr elements in declare-styleable styles were causing the design-time build system to crash. As a result the Resource.designer.cs was not being updated.

  • GitHub 2745:
    The @(JavaDocJar) build action would either cause an MSB3375 error,
    or wasn't used at all.

  • GitHub PR 4614:
    Syntax errors in AndroidManifest.xml always referred to the generated
    version of the file (like
    obj\Debug\90\android\manifest\AndroidManifest.xml), even when the syntax
    error was also present in the hand-written input
    Properties\AndroidManifest.xml file. Manifest errors are now fixed up to
    point to the Properties\AndroidManifest.xml file. An additional note will
    be added to the message to inform the user that the issue might not be in
    that file, but might be caused by code.

  • GitHub PR 4783: error XA1011: Using ProGuard with the D8 DEX compiler is no longer supported... AndroidLinkTool ... could appear without clues about the responsible MSBuild property in certain cases where AndroidLinkTool was empty. Xamarin.Android now provides additional XA1027 and XA1028 build warnings to indicate cases where one of the older EnableProguard or AndroidEnableProguard MSBuild properties is involved.

  • GitHub PR 4846:
    Starting in [Android 11][0], for Fast Deployment to work on an API 30
    device or emulator, the following <queries/> entries must be present in
    AndroidManifest.xml:

    <?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.xamarin.android.helloworld">
      <uses-sdk android:targetSdkVersion="30" />
      <!-- ... -->
      <queries>
        <package android:name="Mono.Android.DebugRuntime" />
        <package android:name="Mono.Android.Platform.ApiLevel_30" />
      </queries>
    </manifest>

    These will be generated if $(AndroidUseSharedRuntime) is true and
    android:targetSdkVersion is 30 or higher.

  • GitHub PR 4966:
    An XA1025 error will now be emitted when $(AndroidAotMode) is Hybrid and one of the targeted ABIs is armeabi-v7a:

    error XA1025: The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild
    property is not currently compatible with the armeabi-v7a target ABI. To
    continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect
    the armeabi-v7a target ABI in the Visual Studio project property pages or edit
    the project file in a text editor and remove 'armeabi-v7a' from the
    'AndroidSupportedAbis' MSBuild property.
    

    Projects using the experimental Hybrid value for the AndroidAotMode MSBuild
    property that also include the value armeabi-v7a in the AndroidSupportedAbis
    MSBuild property will now see this build error to help indicate that
    applications built with these settings would abort during startup on armeabi-v7a
    ABI device environments (GitHub Issue 1218).

    If armeabi-v7a device compatibility is required for the app, the
    AndroidAotMode MSBuild property should be set to Normal or removed from the
    project file completely. To adjust the value of the AndroidAotMode MSBuild
    property, edit the project file in a text editor.

    If armeabi-v7a device compatibility is not required for the app, then deselect
    the armeabi-v7a target ABI in the Visual Studio project property pages to
    resolve the build error.

    In Visual Studio, the target ABIs can be adjusted under Supported
    architectures
    in the Advanced section of the Android Options tab of
    the project property pages

    In Visual Studio for Mac, the target ABIs can be adjusted under Supported
    ABIs
    in the Advanced tab of the Android Build section of the project
    property pages.

    Alternatively, edit the project file in a text editor and remove armeabi-v7a
    from the AndroidSupportedAbis MSBuild property by hand.

  • GitHub PR 5188: Improve performance by lazily loading an Android resource mapping file that is only used for error messages. This reduced the overall build time by 348 milliseconds in a real-world project in an initial clean build or incremental builds with Android resource changes.

  • GitHub Issue 4996: application deploy on Android 11 emulator fails with Mono.AndroidTools.AdbException: secure_mkdirs failed: Permission de...

Read more

Xamarin.Android 11.1.99.168 Preview

10 Nov 22:45
71dc718
Compare
Choose a tag to compare
Pre-release

What's new in Xamarin.Android 11.2

November 10, 2020 — Xamarin.Android 11.1.99.168 was published as part of Visual Studio 2019 version 16.9 Preview 1 and Visual Studio 2019 for Mac version 8.9 Preview 1.

Corresponding Visual Studio 2019 Preview release notes

What's new

Deprecations, removals, and default configuration changes

Build and deployment performance

GitHub PR 5188: Improve performance by lazily loading an Android resource mapping file that is only used for error messages. This reduced the overall build time by 348 milliseconds in a real-world project in an initial clean build or incremental builds with Android resource changes.

Rewritten fast deployment system

As part of this update, the fast deployment system used for Debugging apps has been changed. The shared runtime and shared platform packages are no longer used or required.

The new system also no longer uses the external drive for the fast deployment files. All of the files and tooling are now stored in the application's internal directory. This has an advantage in that when the application is uninstalled, all of the files and the tooling will be removed as well.

The new system will not work on any devices older than Android 5.0 Lollipop (API level 21). This is because it relies on features that only work from API level 21 onwards. Also API level 21 is the lowest supported platform for the runtime, so running and debugging on older devices will be impossible.

See Documentation for more details.

Deprecation of DebugType full and pdbonly

warning XA0125: 'AndroidApp1.pdb' is using a deprecated debug
information level. Set the debugging information to Portable in the
Visual Studio project property pages or edit the project file in a
text editor and set the 'DebugType' MSBuild property to 'portable' to
use the newer, cross-platform debug information level. If this file
comes from a NuGet package, update to a newer version of the NuGet
package or notify the library author.

Support for .mdb or .pdb symbols files that were built with the DebugType MSBuild property set to full or pdbonly is now deprecated. This applies to .mdb and .pdb files in application projects as well as in referenced libraries, including NuGet packages.

Set DebugType to portable in the application project as well all library references. portable is the recommended setting for all projects from now on. The older full and pdbonly settings are for older Windows-specific file formats. .NET 6 and higher will not support those older formats.

In Visual Studio, go to Properties > Build > Advanced in the project property pages and change Debugging information to Portable.

In Visual Studio for Mac, go to Build > Compiler > Debug information in the project property pages and change Debug information to Portable.

If the problematic symbol file comes from a NuGet package, update to a newer version of the package or notify the library author.

Deprecation of AAPT in favor of AAPT2

warning XA1026: Using AAPT is deprecated in favor of AAPT2. Please enable 'Use incremental Android packaging system (aapt2)' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidUseAapt2' MSBuild property to 'true'.

Google has deprecated the AAPT command-line tool in favor of AAPT2 going forward. Xamarin.Android has accordingly now deprecated <AndroidUseAapt2>false</AndroidUseAapt2> as well.

Update the AndroidUseAapt2 MSBuild property to true to select AAPT2. This property corresponds to the Use incremental Android packaging system (aapt2) setting in the Visual Studio project properties pages. Alternatively, remove <AndroidUseAapt2> from the .csproj file to let the build select the default value true.

Important: AAPT2 will in some cases enforce stricter rules on resource files than the previous AAPT, so some adjustments might be needed if you see new error messages that come from AAPT2 itself rather than from the Xamarin.Android build tasks.

If needed, the --legacy switch can run AAPT2 in an AAPT compatibility mode. Add the following to your .csproj file:

<PropertyGroup>
  <AndroidAapt2CompileExtraArgs>--legacy</AndroidAapt2CompileExtraArgs>
</PropertyGroup>

Better file association for Android manifest syntax errors

Syntax errors in AndroidManifest.xml previously always referred to the generated version of the file (like obj\Debug\90\android\manifest\AndroidManifest.xml), even for syntax errors that were also present in the manually configured input Properties\AndroidManifest.xml file. Android manifest errors are now fixed up to point to the Properties\AndroidManifest.xml file. The errors also now include a note to inform users that manifest generation attributes in source code files can be responsible for the errors in some cases.

Removal of ${library.imports:} support in AndroidResgenExtraArgs MSBuild property

A text templating feature for AAPT and AAPT2 has been removed that provided a workaround for the Amazon Fire Phone:

<AndroidResgenExtraArgs>-I ${library.imports:eac-api.jar} -I ${library.imports:euclid-api.jar}</AndroidResgenExtraArgs>

The ${library.imports:...} syntax should no longer be needed by modern Android libraries. .aar files are the recommended way for Java/Kotlin libraries to distribute Android resources to be consumed by Xamarin.Android application projects.

Note that the AndroidResgenExtraArgs and AndroidAapt2LinkExtraArgs MSBuild properties will continue to pass additional arguments to aapt and aapt2 link with the ${library.imports:...} syntax removed.

UseShortFileNames=false is no longer supported

In previous versions of Xamarin.Android, you could set the UseShortFileNames MSbuild property in your .csproj file:

<PropertyGroup>
  <UseShortFileNames>false</UseShortFileNames>
</PropertyGroup>

This would tell Xamarin.Android's MSBuild targets to use the "long" folder names such as:

  • obj\Debug\lp -> __library_projects__
  • obj\Debug\lp*\jl -> library_project_imports
  • obj\Debug\lp*\nl -> native_library_imports

This was useful when UseShortFileNames was a new feature, giving developers a way to "opt out" if they hit a bug. However, UseShortFileNames has defaulted to true since around July 2017 to help with the Windows API maximum path length limitation.

This functionality has been removed from Xamarin.Android. Short file names will be used going forward.

Notable issues fixed

Application and library build and deployment

Read more

Xamarin.Android 11.1.0.17

10 Nov 19:34
Compare
Choose a tag to compare

November 10, 2020 — Xamarin.Android 11.1.0.17 was published as part of Visual Studio 2019 version 16.8 and Visual Studio 2019 for Mac version 8.8.

Corresponding Visual Studio 2019 release notes

What's new compared to Xamarin.Android 11.0

Deprecations, removals, and default configuration changes

Build and deployment performance

GitHub PR 4975: Cache the results of the FilterAssemblies MSBuild task in memory so they can be reused across different MSBuild targets during the build. This decreased incremental build times for the Xamarin.Forms source build from about 170 milliseconds to about 100 milliseconds on a test system. The savings will be bigger on larger solutions.

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 sets this attribute 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>

Corrected garbage collection behavior for Android bindings and bindings projects

In previous Xamarin.Android versions, errors similar to JNI DETECTED ERROR IN APPLICATION: use of deleted global reference and JNI ERROR (app bug): attempt to use stale Global 0x2a2a (should be 0x2a26) could cause apps to abort under certain specific timing conditions where a managed garbage collection started just after a Java.Lang.Object subclass method call.

The Xamarin.Android bindings project build process now includes a fix for this issue.

The set of Android API bindings that are included directly as part of the Xamarin.Android SDK have been updated accordingly to include the fix.

Note: This fix will not solve the problem for other bindings libraries until the libraries are rebuilt using this new Xamarin.Android version. Bindings library authors are therefore encouraged to build and publish new versions of their libraries using this new Xamarin.Android version at their earliest convenience.

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.

Default Android SDK Platform-Tools version update to 30.0

The default Android SDK Platform-Tools version has been updated from 29.0.5 to 30.0.4. This version can be changed per-project if needed via the AndroidSdkPlatformToolsVersion MSBuild property.

Note: Unlike the Platform-Tools, the default Android SDK Build-Tools version is still 29.0.2 in this release. Projects that attempt to override the AndroidSdkBuildToolsVersion MSBuild property to a 30.0.x version will currently fail to build with an error similar to:

error XA0032: Java SDK 11.0 or above is required when using Android SDK Build-Tools 30.0.0.

This error will be removed in a future version now that Xamarin.Android provides its own version of apksigner that is compatible with Java JDK 8. Relatedly, Android SDK Build-Tools version 30.0.2 and higher as provided by the Android SDK Manager are now also compatible with Java JDK 8.

Deprecation of Android Wear references in app projects

Referencing an Android Wear application project from an Android phone application project is now deprecated and will produce a build warning similar to:

warning XA4312: Referencing the Android Wear application project 'com.contoso.wearapp' from an Android application project is deprecated and will no longer be supported in a future version of Xamarin.Android. Remove the Android Wear application project reference from the Android application project and distribute the Wear application as a standalone application instead.

To resolve this warning, remove the reference to Android Wear project from the phone application project and distribute the Android Wear project as a standalone Wear application instead.

Soft deprecation of undocumented ProguardConfigFiles MSBuild property

Xamarin.Android's ProGuard compatibility feature included an undocumented ProguardConfigFiles MSBuild property that could be used as an alternative to the ProguardConfiguration Build Action. That...

Read more

Xamarin.Android 11.1.0.15 Preview

13 Oct 22:03
5e36e6e
Compare
Choose a tag to compare
Pre-release

October 13, 2020 — Xamarin.Android 11.1.0.15 was published as part of Visual Studio 2019 version 16.8 Preview 4 and Visual Studio 2019 for Mac version 8.8 Preview 4.

Corresponding Visual Studio 2019 Preview release notes

What's new

Corrected garbage collection behavior for Android bindings and bindings projects

In previous Xamarin.Android versions, errors similar to JNI DETECTED ERROR IN APPLICATION: use of deleted global reference and JNI ERROR (app bug): attempt to use stale Global 0x2a2a (should be 0x2a26) could cause apps to abort under certain specific timing conditions where a managed garbage collection started just after a Java.Lang.Object subclass method call.

The Xamarin.Android bindings project build process now includes a fix for this issue.

The set of Android API bindings that are included directly as part of the Xamarin.Android SDK have been updated accordingly to include the fix.

Note: This fix will not solve the problem for other bindings libraries until the libraries are rebuilt using this new Xamarin.Android version. Bindings library authors are therefore encouraged to build and publish new versions of their libraries using this new Xamarin.Android version at their earliest convenience.

Issues fixed

Application and library build and deployment

  • Developer Community 1141659: Starting in Xamarin.Android 11.0, the Updating Resources... build step could get stuck indefinitely if .DS_Store or any file starting with . was included in the project with the AndroidResource Build Action.
  • Developer Community 1141659: Starting in Xamarin.Android 11.0, the Updating Resources... build step could get stuck indefinitely if a NuGet package containing an AndroidResource file name starting with . was included in a project.
  • Developer Community 1144910: Starting in Xamarin.Android 11.0, errors similar to error APT2260: resource mipmap/ic_launcher (aka com.companyname.skiasharpsample:mipmap/ic_launcher) not found and error CS0117: 'Resource' does not contain a definition for 'Layout' could prevent building projects when maximum number of parallel project builds was set higher than one in the Visual Studio options or when the -m switch was used in command line MSBuild builds.
  • Developer Community 1182026: Starting in Xamarin.Android 11.0, the Executing compile -o ... build step could get stuck indefinitely on certain systems where Environment.ProcessorCount returned 1.
  • GitHub 4677: On Windows, running the InstallAndroidDependencies MSBuild target on the command line did not yet allow continuous build environments to install the Android SDK dependencies as expected.
  • GitHub 5043: i686-linux-android-ld.EXE: error: cannot open ... Debug\monoandroid10.0\android\typemaps.x86.o: No such file or directory could prevent building projects located under paths that contained .s.

Android API bindings

  • GitHub PR 5106: Bindings for overloads of Map.Of() that took more than fourteen parameters were not yet available.

Bindings projects

  • GitHub 5027: Syntax errors similar to ) expected could prevent building bindings projects after updating the Compile using Android version: (Target Framework) setting to Android 11 (R).
  • Java.Interop GitHub 682: Ignorable warning BG8604: top ancestor ... not found for nested type ... appeared for public types nested under non-public types in Kotlin libraries. Those nested types are now skipped as expected.
  • Java.Interop GitHub 717: Error while processing type ... Type 'android.app.IntentService' was not found. prevented building bindings for libraries with classes that inherited from android.app.IntentService.
  • Java.Interop GitHub 719: Bindings did not yet use GC.KeepAlive() calls to ensure that method arguments would never be garbage collected before they were passed to Java.

Application Mono Framework behavior on device and emulator

This version of Xamarin.Android updates the Mono 6.12 runtime and class libraries from Commit 83105ba2 to Commit be2226b5, adding 17 new commits.

Fixes included for issues reported with Xamarin.Android applications:

  • Mono GitHub 8806: DWARF debugging symbols were incorrect for projects configured to use AOT Compilation with Use LLVM Optimizing Compiler.

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:

Xamarin.Android 11.1.0.17 Preview

20 Oct 20:03
Compare
Choose a tag to compare
Pre-release

October 20, 2020 — Xamarin.Android 11.1.0.17 was published as part of Visual Studio 2019 version 16.8 Preview 5 and Visual Studio 2019 for Mac version 8.8 Preview 5

Corresponding Visual Studio 2019 Preview release notes

What's new

Default Android SDK Platform-Tools version update to 30.0

The default Android SDK Platform-Tools version has been updated from 29.0.5 to 30.0.4. This version can be changed per-project if needed via the AndroidSdkPlatformToolsVersion MSBuild property.

Issues fixed

Bindings projects

  • GitHub 5027: Syntax errors similar to ) expected could prevent building bindings projects after updating the Compile using Android version: (Target Framework) setting to Android 11 (R).

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:

Xamarin.Android 11.1.0.3 Preview

14 Sep 21:04
Compare
Choose a tag to compare
Pre-release

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

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 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:

Xamarin.Android 11.0.99.34 Preview

26 Aug 02:10
Compare
Choose a tag to compare
Pre-release

August 25, 2020 — Xamarin.Android 11.0.99.34 was published as part of Visual Studio 2019 version 16.8 Preview 2 and Visual Studio 2019 for Mac version 8.8 Preview 2.

Corresponding Visual Studio 2019 Preview release notes

What's new

Build and deployment performance in Xamarin.Android 11.0.99.34

GitHub PR 4975: Cache the results of the FilterAssemblies MSBuild task in memory so they can be reused across different MSBuild targets during the build. This decreased incremental build times for the Xamarin.Forms source build from about 170 milliseconds to about 100 milliseconds on a test system. The savings will be bigger on larger solutions.

Deprecation of Android Wear references in app projects

Referencing an Android Wear application project from an Android phone application project is now deprecated and will produce a build warning similar to:

warning XA4312: Referencing the Android Wear application project 'com.contoso.wearapp' from an Android application project is deprecated and will no longer be supported in a future version of Xamarin.Android. Remove the Android Wear application project reference from the Android application project and distribute the Wear application as a standalone application instead.

To resolve this warning, remove the reference to Android Wear project from the phone application project and distribute the Android Wear project as a standalone Wear application instead.

Issues fixed and other small changes in Xamarin.Android 11.0.99.34

Application and library build and deployment

  • Developer Community 1086457: Changes to libraries referenced by the .NET Standard library in a standard Xamarin.Forms solution were not reflected in the running app without a clean rebuild. More generally, this issue affected any library referenced indirectly via a .NET Standard library that had the ProduceReferenceAssembly MSBuild property set to true.
  • Developer Community 1120933: XABLD7019: System.UnauthorizedAccessException: Access to the path ... .lz4 is denied prevented projects from buidling successfully in the Release configuration if the managed linker was disabled in that configuration.
  • GitHub 4565: Errors or warnings similar to Missing class: com.android.tools.lint.detector.api.Detector could appear unexpectedly in the build output of apps that referenced custom Xamarin.Android bindings libraries for .aar files.
  • GitHub PR 4984: Avoid logging the full contents of item lists in diagnostic MSBuild logs in cases where MSBuild conditions only need to check if the item lists are empty or non-empty.

Application behavior on device and emulator

  • GitHub 4893: System.ArgumentNullException: Value cannot be null ... at Java.Interop.TypeManager.RegisterType (System.String java_class, System.Type t) could prevent launching apps on Android 9.0 Pie (API level 28) x86 emulators.

Bindings projects

  • GitHub 4956: warning MSB6002: The command-line for the "BindingsGenerator" task is too long could prevent building bindings library projects, most commonly when they referenced Xamarin.AndroidX NuGet packages.

Application publishing

  • GitHub 4949: The VtsVndkDependencyTest test from the Android Vendor Test Suite would not pass for Xamarin.Android apps installed into system ROMs by device vendors.

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:

Xamarin.Android 11.0.2.0

19 Aug 14:18
Compare
Choose a tag to compare

August 18, 2020 — Xamarin.Android 11.0.2.0 was published as part of in Visual Studio 2019 version 16.7.2 and Visual Studio 2019 for Mac version 8.7.3.

Issues fixed in Xamarin.Android 11.0.2.0

Application behavior on device and emulator

  • Developer Community 1139203, GitHub 4983: Starting in Xamarin.Android 11.0, 'Could not load library: Library '/system/lib64/libmonodroid.so' not found.' ... Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) prevented some application projects from launching successfully in certain build configurations.

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.

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.12.0.89.

For special scenarios where project authors require Xamarin.Android SDK version 11.0.2.0 without any subsequent 11.0 servicing fixes, the fixed-version Visual Studio 2019 version 16.7.2 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 11.0 is based on the open-source Xamarin.Android repositories:

Xamarin.Android 11.0.99.9 Preview

05 Aug 19:43
Compare
Choose a tag to compare
Pre-release

August 5, 2020 — Xamarin.Android 11.0.99.9 was published as part of Visual Studio 2019 version 16.8 Preview 1 and Visual Studio 2019 for Mac version 8.8 Preview 1.

Corresponding Visual Studio 2019 Preview release notes

What's new

Soft deprecation of undocumented ProguardConfigFiles MSBuild property

Since back when ProGuard compatibility was originally added to Xamarin.Android, the feature has included an undocumented ProguardConfigFiles MSBuild property that could be used as an alternative to the ProguardConfiguration Build Action.

Any project authors who are currently using the ProguardConfigFiles MSBuild property are encouraged to update to the ProguardConfiguration Build Action instead.

For example, a .csproj file could contain a use of the ProguardConfiguration MSBuild property similar to the following:

<PropertyGroup>
  <ProguardConfigFiles>
    proguard1.cfg;
    proguard2.cfg;
  </ProguardConfigFiles>
</PropertyGroup>

To update a .csproj that contains a use of ProguardConfiguration like that, remove the ProguardConfiguration element from the .csproj file and instead set the proguard1.cfg and proguard2.cfg to use the ProguardConfiguration Build Action. This adds the files as ProguardConfiguration items in the .csproj file:

<ItemGroup>
  <ProguardConfiguration Include="proguard1.cfg" />
  <ProguardConfiguration Include="proguard2.cfg" />
</ItemGroup>

Issues fixed and other small changes

Application and library build and deployment

Application behavior on device and emulator

  • GitHub 4098: Exceptions similar to java.lang.ClassCastException: mono.android.runtime.JavaObject cannot be cast to float[] prevented passing certain C# types to some Android APIs.
  • GitHub 4632: UNHANDLED EXCEPTION was shown unexpectedly in the application output in certain cases for handled exceptions that had been propagated through both Java and managed code.

Bindings projects

  • Java.Interop GitHub PR 672: Nested Java types with protected visibility within sealed types are now generated with private visibility, avoiding C# warning CS0628.

Thank you

A big Thank You! to community members who contributed improvements in this
release:

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: