Changelog History
Page 1
-
v11.1.99.218
December 08, 2020 -
v11.1.99.168 Changes
November 10, 2020What'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
- ๐ Build and deployment performance
- ๐ Rewritten fast deployment system
- ๐ Deprecation of DebugType full and pdbonly
- ๐ Deprecation of AAPT in favor of AAPT2
- ๐ Better file association for Android manifest syntax errors
- ๐ Removal of ${library.imports:} support in AndroidResgenExtraArgs MSBuild property
- ๐
UseShortFileNames=false
is no longer supported - ๐ Notable issues fixed
- ๐ All enhancements and issues fixed in Xamarin.Android 11.2
- Other changes in Xamarin.Android 11.2
- Thank you
- Installing
- Open source
๐ง Deprecations, removals, and default configuration changes
- ๐ Deprecation of DebugType full and pdbonly
- ๐ Deprecation of AAPT in favor of AAPT2
- ๐ Better file association for Android manifest syntax errors
- ๐ Removal of ${library.imports:} support in AndroidResgenExtraArgs MSBuild property
- ๐
UseShortFileNames=false
is no longer supported
๐ 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 tofull
orpdbonly
is now deprecated. This applies to .mdb and .pdb files in application projects as well as in referenced libraries, including NuGet packages.๐ Set
DebugType
toportable
in the application project as well all library references.portable
is the recommended setting for all projects from now on. The olderfull
andpdbonly
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 totrue
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 valuetrue
.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
andAndroidAapt2LinkExtraArgs
MSBuild properties will continue to pass additional arguments toaapt
andaapt2 link
with the${library.imports:...}
syntax removed.๐
UseShortFileNames=false
is no longer supportedIn 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 totrue
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
Developer Community 1184573: Xamarin Android falsely saying that Resource does not exist in the current context (CS0103). Duplicate
attr
elements indeclare-styleable
styles were causing the design-time build system to crash. As a result the Resource.designer.cs was not being updated.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.
๐ GitHub Issue 4996: application deploy on Android 11 emulator fails with Mono.AndroidTools.AdbException: secure_mkdirs failed: Permission denied
๐ Github PR 5107: Starting in Xamarin.Android 11.0, building solutions in parallel with
msbuild YourSolution.sln -m
could fail with errors such as:obj\Release\100\android\manifest\AndroidManifest.xml(7,0): error APT2260: resource mipmap/ic_launcher (aka com.companyname.skiasharpsample:mipmap/ic_launcher) not found. obj\Release\100\android\manifest\AndroidManifest.xml(7,0): error APT2260: resource string/app_name (aka com.companyname.skiasharpsample:string/app_name) not found. obj\Release\100\android\manifest\AndroidManifest.xml(7,0): error APT2260: resource mipmap/ic_launcher_round (aka com.companyname.skiasharpsample:mipmap/ic_launcher_round) not found. obj\Release\100\android\manifest\AndroidManifest.xml(9,0): error APT2260: resource style/MainTheme.Splash (aka com.companyname.skiasharpsample:style/MainTheme.Splash) not found. Xamarin.Android.Aapt2.targets(226,3): error APT2067: failed processing manifest.
๐ All enhancements and issues fixed in Xamarin.Android 11.2
Other changes in Xamarin.Android 11.2
Thank you
A big _ Thank You! _ to community members who contributed improvements in this release:
- ๐ง @Freakness109, GitHub PR 5093: Implement support for ArchLinux pacman.
Installing
- Visual Studio 2019 version 16.9 Preview โ Visual Studio Installer
- Visual Studio 2019 for Mac 8.9 Preview โ Visual Studio for Mac Installer with the Preview updater channel
For other scenarios, the latest commercial .vsix and .pkg installer packages can be found in the project README.
Open source
Xamarin.Android 11.2 is based on the open-source Xamarin.Android repositories:
- 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 #android channel on the DotNetEvolution Discord server.
-
v11.1.0.3 Changes
September 14, 2020September 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 - ๐ apksigner from Android SDK Build-Tools 30.0.3 now included
- ๐ Issues fixed
- Installing
- Open source
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 theandroid: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 setsextractNativeLibs
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 toaab
.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 aJava.Lang.Object.Dispose(bool)
override threw aSystem.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:
- Visual Studio 2019 version 16.8 Preview 3 โ Visual Studio Installer
- Visual Studio 2019 for Mac 8.8 Preview 3 โ Visual Studio for Mac Installer with the Preview updater channel
For other scenarios, the latest commercial .vsix and .pkg installer packages can be found in the project README.
Open source
Xamarin.Android 11.1 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 #88.
- 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 #android channel on the DotNetEvolution Discord server.
- 0๏ธโฃ
-
v11.1.0.17 Changes
November 10, 2020November 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
- ๐ Visual Studio 2019
- ๐ Visual Studio 2019 for Mac
What's new compared to Xamarin.Android 11.0
- ๐ Build and deployment performance
- 0๏ธโฃ
android:extractNativeLibs
set to"true"
by default - Corrected garbage collection behavior for Android bindings and bindings projects
- ๐ apksigner from Android SDK Build-Tools 30.0.3 now included
- โก๏ธ Default Android SDK Platform-Tools version update to 30.0
- ๐ Deprecation of Android Wear references in app projects
- ๐ Soft deprecation of undocumented ProguardConfigFiles MSBuild property
- ๐ Issues fixed and other small changes
- Thank you
- Installing
- Open source
๐ง Deprecations, removals, and default configuration changes
- 0๏ธโฃ
android:extractNativeLibs
set to"true"
by default - ๐ apksigner from Android SDK Build-Tools 30.0.3 now included
- โก๏ธ Default Android SDK Platform-Tools version update to 30.0
- ๐ Deprecation of Android Wear references in app projects
- ๐ Soft deprecation of undocumented ProguardConfigFiles MSBuild property
๐ 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.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 theandroid: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. ThatProguardConfigFiles
property is now deprecated.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 theProguardConfiguration
element from the .csproj file and instead set the proguard1.cfg and proguard2.cfg files to use the ProguardConfiguration Build Action. This adds the files asProguardConfiguration
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
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 totrue
.Developer Community 1120933: XABLD7019: System.UnauthorizedAccessException: Access to the path ... .lz4 is denied prevented projects from building successfully in the Release configuration if the managed linker was disabled in that configuration.
โก๏ธ 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 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 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 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.
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
returned1
.GitHub 1597: Marshaling of
java.util.Map
instances in files set to use the AndroidInterfaceDescription Build Action was incorrect.๐ 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 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 4818: Projects that had the undocumented
AndroidAotMode
MSBuild property set to the experimentalHybrid
value did not strip away the IL from the resulting managed assemblies as expected.๐ GitHub PR 4824: No longer create NOTICE files in app packages.
๐ GitHub PR 4829: No longer fast deploy Android resources for the
Assemblies:Dexes
fast deployment mode.๐ 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.
โก๏ธ 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 setsextractNativeLibs
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 toaab
.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 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.
๐ 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 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.
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.
GitHub 4989: Calling
this.Dispose()
from within aJava.Lang.Object.Dispose(bool)
override threw aSystem.ArgumentException
.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 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.
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 PR 672: For nested Java types that have
protected
visibility withinsealed
types, generate bindings that haveprivate
visibility to avoid C# warning CS0628.โ 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 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.
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 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.
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.
Thank you
A big _ Thank You! _ to community members who contributed improvements in this release:
- ๐ Mohamed Akram (@mohd-akram), GitHub PR 4747: Add support for building xamarin-android source checkouts on Fedora.
Installing
โก๏ธ To get the new version in Visual Studio, update Visual Studio:
- Visual Studio 2019 version 16.8 โ Visual Studio Installer
- Visual Studio 2019 for Mac version 8.8 โ 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.12.0.93.
For special scenarios where users require Xamarin.Android SDK version 11.1.0.17 without any subsequent 11.1 servicing fixes, the fixed-version Visual Studio 2019 version 16.8.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 11.1 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 #105.
- 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 #android channel on the DotNetEvolution Discord server.
-
v11.1.0.15 Changes
October 13, 2020October 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
- ๐ Issues fixed
- Installing
- Open source
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
returned1
. - ๐ 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:
- Visual Studio 2019 version 16.8 Preview 4 โ Visual Studio Installer
- Visual Studio 2019 for Mac 8.8 Preview 4 โ Visual Studio for Mac Installer with the Preview updater channel
For other scenarios, the latest commercial .vsix and .pkg installer packages can be found in the project README.
Open source
Xamarin.Android 11.1 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 #105.
- 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 #android channel on the DotNetEvolution Discord server.
-
v11.0.99.9 Changes
August 05, 2020August 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
- ๐ Issues fixed and other small changes
- Installing
- Thank you
- Open source
๐ 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 theProguardConfiguration
element from the .csproj file and instead set the proguard1.cfg and proguard2.cfg to use the ProguardConfiguration Build Action. This adds the files asProguardConfiguration
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
- GitHub 4818: Projects that had the undocumented
AndroidAotMode
MSBuild property set to the experimentalHybrid
value did not strip away the IL from the resulting managed assemblies as expected. - ๐ GitHub PR 4824: No longer create NOTICE files in app packages.
- ๐ GitHub PR 4829: No longer fast deploy Android resources for the
Assemblies:Dexes
fast deployment mode.
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 withinsealed
types are now generated withprivate
visibility, avoiding C# warning CS0628.
Thank you
A big _ Thank You! _ to community members who contributed improvements in this
๐ release:- ๐ Mohamed Akram (@mohd-akram), GitHub PR 4747: Add support for building xamarin-android source checkouts on Fedora.
Installing
โก๏ธ To get the new version in Visual Studio, update Visual Studio:
- Visual Studio 2019 version 16.8 Preview 1 โ Visual Studio Installer
- Visual Studio 2019 for Mac 8.8 Preview 1 โ Visual Studio for Mac Installer with the Preview updater channel
For other scenarios, the latest commercial .vsix and .pkg installer packages can be found in the project README.
Open source
Xamarin.Android 11.1 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 #88.
- 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 #android channel on the DotNetEvolution Discord server.
-
v11.0.99.34 Changes
August 26, 2020August 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.
What's new
- ๐ Build and deployment performance
- ๐ Deprecation of Android Wear references in app projects
- ๐ Issues fixed and other small changes
- Installing
- Open source
๐ 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 totrue
. - 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:
- Visual Studio 2019 version 16.8 Preview 2 โ Visual Studio Installer
- Visual Studio 2019 for Mac 8.8 Preview 2 โ Visual Studio for Mac Installer with the Preview updater channel
For other scenarios, the latest commercial .vsix and .pkg installer packages can be found in the project README.
Open source
Xamarin.Android 11.1 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 #88.
- 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 #android channel on the DotNetEvolution Discord server.
-
v11.0.2.0 Changes
August 19, 2020August 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:
- Visual Studio 2019 version 16.7.2 โ Visual Studio Installer
- Visual Studio 2019 for Mac version 8.7.3 โ 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.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:
- ๐ 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 #88.
- 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 #android channel on the DotNetEvolution Discord server.
-
v11.0.0.3 Changes
August 05, 2020August 5, 2020 โ Xamarin.Android 11.0.0.3 was published as part of Visual Studio 2019 version 16.7 and Visual Studio 2019 for Mac version 8.7.
๐ Corresponding Visual Studio 2019 release notes
- ๐ Visual Studio 2019
- ๐ Visual Studio 2019 for Mac
What's new compared to Xamarin.Android 10.3
- ๐ Build and deployment performance
- ๐ฆ Smaller app package sizes
- Bindings for Android 11 Beta
- Preliminary Java JDK 11 compatibility
- Mono.Android nullable reference types compatibility
- Tidier IntelliSense suggestions for Java.Lang.Object subclasses
- ๐ Bindings projects support for methods with more than 14 parameters
- Bindings projects enumeration enhancements
- JI_JAVA_HOME environment variable for custom Java JDK paths
- ๐ Issues fixed
- Installing
- Thank you
- Open source
๐ง Deprecations, removals, and default configuration changes
- ๐ Assemblies compressed by default in Release configuration
- ๐ XA1023 warning for upcoming DX DEX compiler deprecation
- โ Other warning and error changes
- โก๏ธ Tool and library version updates
๐ Build and deployment performance
- ๐ GitHub PR 4190: Switch to running AAPT2 in single-file mode rather than
--dir
mode. This reduced the total incremental build time from about 16.4 seconds to about 5.5 seconds for a test project when a single Android resource file was changed between builds. - ๐ GitHub PR 4750: Skip checking for uses of
AppDomain.CreateDomain()
in assemblies provided by Xamarin.Android. This reduced the time for theLinkAssembliesNoShrink
from about 2.6 seconds to about 1.8 seconds for an initial clean build of small Xamarin.Forms test app. - โก๏ธ Java.Interop GitHub PR 624, Java.Interop GitHub PR 627, Java.Interop GitHub PR 628: Update the CRC-64 algorithm used during builds to take advantage of a more efficient calculation technique. This reduced the total incremental build time from about 8.7 seconds to about 8.5 seconds for a small Xamarin.Forms app when one line of a C# file was changed between builds.
๐ฆ Smaller app package sizes
๐ Managed assemblies are now compressed by default for Release configuration builds, resulting in significantly smaller APK and Android App Bundle sizes. Assemblies are compressed with the LZ4 algorithm during builds and then decompressed on device during app startup.
For a small example Xamarin.Forms application, this reduced the APK size from about 23 megabytes to about 17 megabytes while only increasing the time to display the first page of the app from about 780 milliseconds to about 790 milliseconds.
If needed, the new behavior can be disabled for a particular project by opening the project file in Visual Studio or another text editor and setting the
AndroidEnableAssemblyCompression
MSBuild property tofalse
in the .csproj file:\<PropertyGroup\> \<AndroidEnableAssemblyCompression\>false\</AndroidEnableAssemblyCompression\> \</PropertyGroup\>
Note: This feature is intended to replace the older Bundle assemblies into native code Visual Studio Enterprise feature for purposes of app size savings. The
AndroidEnableAssemblyCompression
property takes precedence if both features are enabled. Project authors who no longer need the Bundle assemblies into native code feature can now disable it or remove theBundleAssemblies
MSBuild property from the .csproj file:\<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "\> \<DebugSymbols\>True\</DebugSymbols\> \<DebugType\>portable\</DebugType\> \<Optimize\>True\</Optimize\> \<OutputPath\>bin\Release\\</OutputPath\> \<DefineConstants\>TRACE\</DefineConstants\> \<ErrorReport\>prompt\</ErrorReport\> \<WarningLevel\>4\</WarningLevel\> \<AndroidManagedSymbols\>true\</AndroidManagedSymbols\> \<AndroidUseSharedRuntime\>False\</AndroidUseSharedRuntime\> \<AndroidLinkMode\>SdkOnly\</AndroidLinkMode\> \<EmbedAssembliesIntoApk\>True\</EmbedAssembliesIntoApk\>- \<BundleAssemblies\>true\</BundleAssemblies\> \</PropertyGroup\>
Background information
For comparison, for the small test Xamarin.Forms application with all target ABIs enabled, the Bundle assemblies into native code feature increases the APK size from about 23 megabytes to about 26 megabytes while increasing the time to display the first page of the app from about 780 milliseconds to about 850 milliseconds.
If only one target ABI is enabled for the test application, such as arm64-v8a, the Bundle assemblies into native code feature decreases the APK size from around 16 megabytes to around 7.5 megabytes, while the new LZ4 approach decreases the size to around 8 megabytes. Time to display the first page is the same in this case as with all target ABIs enabled.
The number of target ABIs affects the size comparison because Bundle assemblies into native code uses a separate copy of the compressed assemblies for each ABI, while the new LZ4 approach shares them across all target ABIs.
Bindings for Android 11 Beta
This version includes bindings for the Android 11 Beta from Google. See the Android 11 Beta documentation for additional information about the behavior and API changes in this new Android version. Because Android 11 Beta provides the finalized SDK and NDK APIs, the Xamarin.Android bindings are now also finalized and the Xamarin.Android SDK version number has been updated to 11.0. To use the bindings for the new APIs in a Xamarin.Android project, set Compile using Android version: (Target Framework) to Android 11 (R) under the Application tab of the Visual Studio project property pages. This sets the
TargetFrameworkVersion
property tov11.0
in the .csproj file:\<TargetFrameworkVersion\>v11.0\</TargetFrameworkVersion\>
Note: The default and recommended Android SDK Build-Tools version for Xamarin.Android is still 29 because Build-Tools version 30.0 currently requires Java JDK 9 or higher, while both Xamarin.Android and Android Studio still require JDK 8. Android SDK Build-Tools 29 is compatible with the Android 11 bindings, so it is recommended to continue using Android SDK Build-Tools 29 for now.
๐ Attempting to use Android SDK Build-Tools 30.0 with Java JDK 8 results in the following error:
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
Project authors who wish to try Android SDK Build-Tools 30.0 can follow the steps under Preliminary Java JDK 11 compatibility to install and configure Java JDK 11.
๐ 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 11 (R) target framework version. Project authors are encouraged to switch to the new interface members likeITextClassifier.HintTextIsEditable
at their earliest convenience.Preliminary Java JDK 11 compatibility
๐ Xamarin.Android can now use Java JDK 11 to build libraries and applications.
๐ JDK 11 is not yet installed or required by default for Xamarin.Android, but the
apksigner
tool in Android SDK Build-Tools version 30 does require JDK 11, so project authors who are using the bindings for Android 11 Beta and want to experiment with setting theAndroidSdkBuildToolsVersion
MSBuild property to version 30.0.0 or higher will need to use JDK 11.To do so:
Install a distribution of JDK 11, such as JetBrains Runtime jbrsdk.
On Windows, open Tools > Options in Visual Studio, select the Xamarin > Android Settings node, and set Java Development Kit Location to the root of the JDK 11 installation.
On macOS, open Visual Studio > Preferences , select the Projects > SDK Locations > Android node, open the Locations tab, and set the Java SDK (JDK) Location to the root of the JDK 11 installation.
๐ง Alternatively, to configure the JDK path per project, open the project file in Visual Studio or another text editor and set the
JavaSdkDirectory
MSBuild property to the root of the JDK 11 installation. For example:\<PropertyGroup\> \<JavaSdkDirectory\>C:\Program Files\jbrsdk\</JavaSdkDirectory\> \</PropertyGroup\>
Note: The error that appears when attempting to use Android SDK Build-Tools 30.0 th Java JDK 8 is:
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
Known Issues
- GitHub 4789: error XACLP7004: System.ArgumentException: Directory ... obj\Debug\javadocs...' does not appear to be an android doc reference directory. prevents using the JavaSourceJar Build Action in bindings projects.
Mono.Android nullable reference types compatibility
The Mono.Android assembly has been annotated for compatibility with C# 8.0 nullable reference type checks. Projects can now optionally place code that uses types from Mono.Android in a nullable context to take advantage of additional compiler nullability checks. For example, to enable nullability checks for all code in a project, set the
Nullable
MSBuild property toenable
in the .csproj file:\<PropertyGroup\> \<Nullable\>enable\</Nullable\> \</PropertyGroup\>
๐ When this property set, the build will emit warnings if any code does not properly account for possible
null
values passed into or returned from APIs in the Mono.Android assembly.๐ See the nullable reference types documentation for more information.
Note: The majority of Mono.Android, including the nullability annotations, is automatically generated from the Android Java source. The annotations intentionally preserve any upstream bugs in the nullability information provided by the Android source code.
Tidier IntelliSense suggestions for Java.Lang.Object subclasses
๐
Java.Lang.Object
contains several properties and methods that are required to bepublic
to support Xamarin.Android Java bindings but are not intended to be used in hand-written code. These members are now hidden from IntelliSense, making it easier to find the useful members.๐ Bindings projects support for methods with more than 14 parameters
๐ Xamarin.Android bindings projects now support binding Java methods that have any number of parameters instead of the previous limit of 14.
Bindings projects enumeration enhancements
The Transforms\EnumFields.xml file in bindings projects now allows
<mapping>
and<field>
elements that use justclr-enum-type
andclr-name
attributes, with nojni-interface
orjni-name
attributes. This provides additional flexibility to define custom C# enumerations that are visible to the bindings generation process and do not correspond to any Java type in the bound Java library. For example:\<mapping clr-enum-type='Contoso.Permissions' bitfield='true'\> \<field clr-name='Read' value='0' /\> \<field clr-name='Write' value='1' /\> \<field clr-name='Execute' value='2' /\> \</mapping\>
For enumerations that do correspond to Java types, project authors should continue to include the
jni-interface
andjni-name
attributes as before.JI_JAVA_HOME environment variable for custom Java JDK paths
Xamarin.Android will now look for the contents of an environment variable named
JI_JAVA_HOME
as another way to customize the Java JDK path used during the build. In cases where both theJI_JAVA_HOME
environment variable and theJavaSdkDirectory
MSBuild property are set to custom values, the MSBuild property takes precedence.In general, this environment does not need to be adjusted, but in certain special scenarios, having the option to customize the JDK path via an environment variable might provide useful flexibility.
๐ XA1023 warning for upcoming DX DEX compiler deprecation
Projects that have Dex compiler set to dx in the Visual Studio project property pages will now get a build warning:
warning XA1023: Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.
To resolve this warning, set the Dex compiler in the Visual Studio project property pages to d8 or edit the project file in Visual Studio or another text editor and set the
AndroidDexTool
MSBuild property tod8
:\<PropertyGroup\> \<AndroidDexTool\>d8\</AndroidDexTool\> \</PropertyGroup\>
Background information
๐ Google has deprecated the DX DEX compiler in favor of the D8 DEX compiler. After February 1, 2021, DX will no longer be a part of the Android SDK or Android Studio. Project authors are encouraged to migrate their projects to D8 at their earliest convenience to prepare for this change.
โ Other warning and error changes
โก๏ธ Updated XA0113 warning for Google Play submission requirements
The XA0113 warning has been updated to reflect a more recent minimum target version of Android 9 (API level 28) for submissions to the Google Play store. The following warning will now appear for projects that have an earlier version set under Compile using Android version: (Target Framework) in the Visual Studio project property pages:
warning XA0113: Google Play requires that new applications and updates must use a TargetFrameworkVersion of v9.0 (API level 28) or above. You are currently targeting v8.0 (API level 26).
๐ง XA0119 error for incompatible use of Android App Bundle format in Debug configuration
๐ฆ The Android App Bundle publishing format is not currently compatible with the recommended fast deployment settings for Debug configuration deployments. Previously, projects that had Android Package Format (
AndroidPackageFormat
) set to aab in the Debug configuration that also had the recommended Use Shared Runtime ( Use Shared Mono Runtime on macOS) setting enabled would produce a build warning and then fail to launch on device.๐ง Because this configuration is not currently supported, Xamarin.Android now produces an error for it instead of a warning:
error XA0119: Using the shared runtime and Android App Bundles at the same time is not currently supported. Use the shared runtime for Debug configurations and Android App Bundles for Release configurations.
๐ฆ To resolve this error, change the Android Package Format setting in the Visual Studio project property pages to apk for the Debug configuration. This corresponds to the
apk
value for theAndroidPackageFormat
MSBuild property in the .csproj file:\<PropertyGroup\> \<AndroidPackageFormat\>apk\</AndroidPackageFormat\> \</PropertyGroup\>
๐ This error is only relevant for Debug configuration builds. Release configuration builds can continue to use the Android App Bundle packaging format.
๐ Bindings projects XA4231 warning for deprecated jar2xml parser
๐ Any bindings project that has the
AndroidClassParser
MSBuild property set to the oldjar2xml
parser or any other unrecognized value will now get a XA4231 build warning:warning XA4231: The Android class parser 'jar2xml' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse' instead.
๐ To resolve this warning, update the Android Class Parser setting in the Visual Studio project property pages or the .jar file parser setting in Visual Studio for Mac to class-parse. This corresponds to the
class-parse
value for theAndroidClassParser
MSBuild property in the .csproj file:\<PropertyGroup\> \<AndroidClassParser\>class-parse\</AndroidClassParser\> \</PropertyGroup\>
๐ Bindings projects XA4232 warning for deprecated XamarinAndroid code generation target
๐ Any bindings project that has the
AndroidCodegenTarget
MSBuild property set to the oldXamarinAndroid
code generation target or any other unrecognized value will now get a XA4232 build warning:warning XA4232: The Android code generation target value 'XamarinAndroid' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.
To resolve this warning, update the Android Codegen target setting in the Visual Studio project property pages or the Code generation target setting in Visual Studio for Mac to XAJavaInterop1. This corresponds to the
XAJavaInterop1
value for theAndroidCodegenTarget
MSBuild property in the .csproj file:\<PropertyGroup\> \<AndroidCodegenTarget\>XAJavaInterop1\</AndroidCodegenTarget\> \</PropertyGroup\>
โก๏ธ Tool and library version updates
โก๏ธ D8 and R8 version update to 1.6.82
โก๏ธ The version of the D8 DEX compiler and R8 code shrinker included in Xamarin.Android has been updated from 1.5.68 to 1.6.82.
โก๏ธ bundletool version update to 0.14.0
๐ The version of the
bundletool
executable included in Xamarin.Android has been updated from 0.10.2 to 0.14.0, bringing in several improvements and bug fixes.โก๏ธ AAPT2 version update to 4.0.0
โก๏ธ The version of the Android Asset Packaging Tool AAPT2 included in Xamarin.Android has been updated from 3.5.3 to 4.0.0.
โก๏ธ Manifest merger tool version update to 27.0.0
๐ The version of the manifest merger tool included in Xamarin.Android has been updated from 26.5.0 to 27.0.0.
โก๏ธ ProGuard version update to 6.2.2
โก๏ธ The version of ProGuard included in Xamarin.Android has been updated from 5.3.2 to 6.2.2, bringing in a number of improvements and bug fixes.
Note: ProGuard is only relevant for projects configured to use the older DX DEX compiler. Project authors are recommended to update to the newer D8 DEX compiler at their earliest convenience.
โก๏ธ Mono.Data.Sqlite SQLite version update
The version of SQLite used by Mono.Data.Sqlite in Xamarin.Android has been updated from 3.31.1 to 3.32.1, bringing in security fixes, improvements, and bug fixes.
๐ Issues fixed in Xamarin.Android 11.0.0.3
๐ Design-time builds
- โก๏ธ Developer Community 896179, GitHub 4273: The IDE could become unresponsive for tens of seconds after changes were saved to an Android layout file in projects configured to use AAPT2.
Application behavior on device and emulator
- Developer Community 970610, Java.Interop GitHub 661: System.TypeLoadException: 'Could not load type 'Android.App.Application.IActivityLifecycleCallbacks' could cause apps using the Android 11 Developer Preview bindings to abort during startup.
- Developer Community 1045818: Starting in Xamarin.Android 10.3 on Windows, errors similar to Java.Lang.RuntimeException: 'Font asset not found Fonts/fontello.ttf' could cause apps to abort unexpectedly on device after they were updated and redeployed from Visual Studio on Windows.
- ๐ Developer Community 1050379, GitHub 4795: Starting in Xamarin.Android 10.3, Unable to activate instance of type Android.Util.SparseArray`1[E] could cause apps built in the Debug configuration to abort.
- โก๏ธ GitHub 3784, GitHub 4471: An outdated version of the Mono Shared Runtime package was sometimes left on target development devices and emulators after Xamarin.Android version updates. This could result in unexpected behaviors in Debug configuration apps until the old shared runtime was manually uninstalled.
- GitHub 4152: Unable to read profile ... The system cannot find the file specified prevented the
FinishAotProfiling
MSBuild target from completing successfully if the location ofadb
was not in thePATH
environment variable. - GitHub 4542: error CS1681: You cannot redefine the global extern alias prevented building app projects successfully if the .csproj file included
global
in the<Aliases></Aliases>
metadata element of a referenced Xamarin.Android class library. - GitHub PR 4589:
ObjectDisposedException
could in theory be thrown during cancellation ofAndroidClientHandler
requests, depending on the particular timing of cancellation and object disposal. The time window where this can happen is now narrower. - GitHub 4662: In projects configured to use the recently added
manifestmerger.jar
Android manifest merging option,tools:node="remove"
did not yet remove AndroidManifest.xml nodes generated by C# attributes in referenced library projects. - GitHub 4772, GitHub 4852: System.DllNotFoundException: libmono-native.so assembly:<unknown assembly> type:<unknown type> member:(null) could cause apps to abort during startup on certain Android 5.0 Lollipop (API level 21) and Android 5.1 Lollipop (API level 22) devices.
- โก๏ธ GitHub PR 4779: error XA1011: Using ProGuard with the D8 DEX compiler is no longer supported. Please update
$(AndroidLinkTool)
tor8
. did not mention the corresponding term code shrinker that is used in the Visual Studio project property pages and did not mention thatAndroidLinkTool
is an MSBuild property. - GitHub 4791: Starting in Xamarin.Android 10.3, many typemap: module matching MVID [...] not found. messages were logged to the application output for certain running apps, obscuring other logging statements of interest. These messages were diagnostic and did not indicate problems in the apps.
- GitHub 4805: Starting in Xamarin.Android 10.3, localized resources from .resx files in Xamarin.Android application projects were no longer deployed when building and deploying from within Visual Studio to an attached device or emulator. In contrast, clean builds started on the command line worked as expected.
- GitHub 4809: Starting in Xamarin.Android 10.3, System.MemberAccessException: Cannot create an instance of ... could cause apps built in the Debug configuration to abort when attempting to use certain APIs involving types that have both generic and non-generic versions such as
Android.Widget.ArrayAdapter
. - GitHub PR 4846: On Android 11 (API level 30) devices and emulators, java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider: java.lang.RuntimeException: Unable to find application Mono.Android.Platform.ApiLevel_30! caused apps to abort during startup for projects with the Target Android version set to API level 30 in the Android Manifest tab of the project property pages.
๐ Application and library build and deployment
- ๐ Developer Community 1061307 Changes to files set to use the LinkDescription Build Action were not included as expected in incremental builds. Clean rebuilds were required to propagate the changes as expected.
- Developer Community 1076396: DllImport error loading library '__Internal': 'Could not load library: Library '/system/lib64/libmonodroid.so' not found.' caused apps to abort during startup when built in an unsupported Debug configuration, with Android Package Format set to aab , because the build only provided a warning. The build now produces an error instead.
- GitHub 2042: The Mono.Android assembly did not yet surface the nullability information provided by the upstream Android source code for use in C# 8.0 nullable contexts.
- ๐ GitHub 4439: Invalid values of the
AndroidDexTool
MSBuild property produced a misleading error during deployment instead of an error during the build. Invalid values are now ignored and the default D8 DEX tool is used instead. - GitHub PR 4578: The source directory is under the output directory. Skip it. build error did not yet mention the relevant MSBuild item type or the current path of the invalid item.
- GitHub PR 4640: System.ArgumentException: Illegal characters in path could prevent successful automatic detection of the Android SDK location during builds in some cases. One possible cause of this issue has now been addressed.
- GitHub 4790: Starting in Xamarin.Android 10.3, errors similar to error XA3006: Could not compile native assembly file: typemaps.x86.s caused incremental builds to fail after changes to the Supported architectures (
AndroidSupportedAbis
) in the Advanced section of the Android Options tab in the project property pages. - ๐ GitHub 4804: Starting in Xamarin.Android 10.3, Failed to parse APK info: failed to parse AndroidManifest.xml, error: %!s() prevented incremental deployments of certain projects that had references to libraries containing AndroidManifest.xml files.
- โ Java.Interop GitHub PR 622: warning : Failed to read ... with debugging symbols. Retrying to load it without it. and Mono.Cecil.Cil.SymbolsNotMatchingException: Symbols were found but are not matching the assembly could appear during builds, for example for projects using obfuscation tools. To align more closely with the behavior of other common .NET project types that do not warn about mismatched debugger symbols, Xamarin.Android projects now log these as informational messages instead of warnings.
- For Android 11 (API level 30) emulators, failed to install Mono.Android.Platform.ApiLevel_30.apk:Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Scanning Failed.: No signature found in package of version 2 or newer for package Mono.Android.Platform.ApiLevel_30] prevented deploying successfully in the Debug configuration with the shared runtime enabled, which is the recommended default.
Application Mono Framework behavior on device and emulator
๐ This version of Xamarin.Android updates the Mono 6.12 runtime and class libraries from Commit 165f4b03 to Commit 83105ba2, adding 21 new commits.
๐ Fixes included for issues reported with Xamarin.Android applications:
- Developer Community 952568, Mono GitHub 18865: Starting in Xamarin.Android 10.2,
SslStream.BeginRead()
andSslStream.BeginWrite()
would block if called at the same time. - GitHub 4713: Starting in Xamarin.Android 10.3, SIGSEGV during
monodroid_typemap_java_to_managed
could cause apps to abort if the application was built with theAndroidEnablePreloadAssemblies
MSBuild property set tofalse
. - GitHub 4817: * Assertion at ... mono/mini/method-to-ir.c:12332, condition `var->opcode == OP_REGOFFSET' not met caused apps to abort in the Release configuration when attempting to use the
new()
type constraint in combination with theXElement
type.
IDE compatibility
- GitHub 4582: Some
Java.Lang.Object
properties and methods likeHandle
andPeerReference
appeared in IntelliSense suggestions even though they were primarily intended for use only in generated code. - ๐ GitHub 4675: The project ... is missing Android SDKs required for building. prevented building without the Android NDK installed for projects with Enable Startup Tracing or AOT Compilation enabled.
Android API bindings
- ๐ GitHub 4752: error XAGJS7004: System.ArgumentException: Unsupported ForegroundServiceType value '9'. prevented using bitwise combinations of multiple values of
Android.Content.PM.ForegroundService
.
Bindings projects
- GitHub PR 4579: Unrecognized transform root element build error did not yet mention the relevant MSBuild item type.
- GitHub PR 4579: Specified source jar not found and Specified reference jar not found build errors did not yet mention Java library types other than JAR files.
- Java.Interop GitHub 515: Bindings projects did not yet have a convenient way to add C# enumerations that did not correspond to Java types.
- โ Java.Interop GitHub 588: Warnings similar to warning BG8503: Invalidating Java.Util.IMap and all nested types because some of its methods were invalid. could prevent the bindings generator from providing bindings for interfaces even when the invalid methods were all marked
static
. Because classes are not required to implementstatic
methods from Java interfaces, the bindings generator now ignores invalidstatic
methods and continues generating bindings for interfaces in these cases. - ๐ Java.Interop GitHub PR 611: Building a binding project that had a reference to another binding project performed some redundant work for assemblies referenced by both projects.
- ๐ Java.Interop GitHub 631: Xamarin.Android bindings projects did not yet support binding Java methods with more than 14 parameters.
- โ Java.Interop GitHub PR 651: Unactionable warning : class-parse: warning: method ... Local variables array has 0 entries ... descriptor has 1 entries! prevented the bindings generator from detecting parameter names for constructor methods marked with the Kotlin
@JvmOverloads
annotation.
Thank you
A big _ Thank You! _ to community members who contributed improvements in this release:
- ๐ Andrey Kurdyumov (@kant2002), GitHub PR 4275: Add compatibility with using a custom value in the
NUGET_PACKAGES
environment variable when building xamarin-android from source. - โ Andrey Kurdyumov (@kant2002), GitHub PR 4289: Update the instructions for building the Xamarin.Android-Tests.sln solution in xamarin-android source checkouts on Windows.
- โ
Andrey Kurdyumov (@kant2002), GitHub PR 4332: Fix GitHub 4306 so that
xabuild
can successfully build the Xamarin.Android-Tests.sln solution more than once in xamarin-android source checkouts. - ๐ Janus Weil (@janusw), GitHub PR 4346: Update the xamarin-android source build dependencies documentation for Linux.
- Kyle Seongwoo Jun (@kyle-seongwoo-jun), GitHub PR 4525: Mention the .aab file format in addition to the .apk file format in Xamarin.Android's draft document about .NET 5.
Installing
โก๏ธ To get the new version in Visual Studio, update Visual Studio:
- Visual Studio 2019 version 16.7 โ Visual Studio Installer
- Visual Studio 2019 for Mac version 8.7 โ 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.12.0.89.
For special scenarios where users require Xamarin.Android SDK version 11.0.0.3 without any subsequent 11.0 servicing fixes, the fixed-version Visual Studio 2019 version 16.7.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 11.0 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 #88.
- 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 #android channel on the DotNetEvolution Discord server.
-
v10.4.0.0 Changes
June 23, 2020June 23, 2020 โ Xamarin.Android 10.4.0.0 was published as part of Visual Studio 2019 version 16.7 Preview 3 and Visual Studio 2019 for Mac version 8.7 Preview 3.
๐ Corresponding Visual Studio 2019 Preview release notes
In Xamarin.Android 10.4.0.0
- ๐ Build and deployment performance
- ๐ฆ Smaller app package sizes
- Minimum compatible Android version changed back to Android 4.4 KitKat (API level 19)
- Enumerations for new constants in Android 11 Developer Preview 4
- Preliminary Java JDK 11 compatibility
- โก๏ธ Mono.Data.Sqlite SQLite version update
- JI_JAVA_HOME environment variable for custom Java JDK paths
- ๐ Issues fixed
- Installing
- Open source
๐ง Deprecations, removals, and default configuration changes
- ๐ XA1023 warning for upcoming DX DEX compiler deprecation
- โก๏ธ Updated XA0113 warning for Google Play submission requirements
๐ Build and deployment performance
- ๐ GitHub PR 4750: Skip checking for uses of
AppDomain.CreateDomain()
in assemblies provided by Xamarin.Android. This reduced the time for theLinkAssembliesNoShrink
from about 2.6 seconds to about 1.8 seconds for an initial clean build of small Xamarin.Forms test app.
๐ฆ Smaller app package sizes
๐ Managed assemblies are now compressed by default for Release configuration builds, resulting in significantly smaller APK and Android App Bundle sizes. Assemblies are compressed with the LZ4 algorithm during builds and then decompressed on device during app startup.
For a small example Xamarin.Forms application, this reduced the APK size from about 23 megabytes to about 17 megabytes while only increasing the time to display the first page of the app from about 780 milliseconds to about 790 milliseconds.
If needed, the new behavior can be disabled for a particular project by opening the project file in Visual Studio or another text editor and setting the
AndroidEnableAssemblyCompression
MSBuild property tofalse
in the .csproj file:\<PropertyGroup\> \<AndroidEnableAssemblyCompression\>false\</AndroidEnableAssemblyCompression\> \</PropertyGroup\>
Note: This feature is intended to replace the older Bundle assemblies into native code Visual Studio Enterprise feature for purposes of app size savings. The
AndroidEnableAssemblyCompression
property takes precedence if both features are enabled. Project authors who no longer need the Bundle assemblies into native code feature can now disable it or remove theBundleAssemblies
MSBuild property from the .csproj file:\<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "\> \<DebugSymbols\>True\</DebugSymbols\> \<DebugType\>portable\</DebugType\> \<Optimize\>True\</Optimize\> \<OutputPath\>bin\Release\\</OutputPath\> \<DefineConstants\>TRACE\</DefineConstants\> \<ErrorReport\>prompt\</ErrorReport\> \<WarningLevel\>4\</WarningLevel\> \<AndroidManagedSymbols\>true\</AndroidManagedSymbols\> \<AndroidUseSharedRuntime\>False\</AndroidUseSharedRuntime\> \<AndroidLinkMode\>SdkOnly\</AndroidLinkMode\> \<EmbedAssembliesIntoApk\>True\</EmbedAssembliesIntoApk\>- \<BundleAssemblies\>true\</BundleAssemblies\> \</PropertyGroup\>
Background information
For comparison, for the small test Xamarin.Forms application with all target ABIs enabled, the Bundle assemblies into native code feature increases the APK size from about 23 megabytes to about 26 megabytes while increasing the time to display the first page of the app from about 780 milliseconds to about 850 milliseconds.
If only one target ABI is enabled for the test application, such as arm64-v8a, the Bundle assemblies into native code feature decreases the APK size from around 16 megabytes to around 7.5 megabytes, while the new LZ4 approach decreases the size to around 8 megabytes. Time to display the first page is the same in this case as with all target ABIs enabled.
The number of target ABIs affects the size comparison because Bundle assemblies into native code uses a separate copy of the compressed assemblies for each ABI, while the new LZ4 approach shares them across all target ABIs.
Minimum compatible Android version changed back to Android 4.4 KitKat (API level 19)
๐ The minimum compatible Android version for Xamarin.Android apps has been changed back to Android Android 4.4 KitKat (API level 19) to align more closely with the Xamarin.Forms supported platforms.
๐ This reverts the change from the previous preview that updated the minimum compatible version to Android 5.0 Lollipop.
Enumerations for new constants in Android 11 Developer Preview 4
๐ The preview bindings for Android 11 Developer Preview 4 now provide strongly typed enumerations for new constants that are part of Android 11.
Preliminary Java JDK 11 compatibility
๐ Xamarin.Android can now use Java JDK 11 to build libraries and applications.
๐ JDK 11 is not yet installed or required by default for Xamarin.Android, but the
apksigner
tool in Android SDK Build-Tools version 30 does require JDK 11, so project authors who are using the preview bindings for Android 11 Developer Preview 4 and want to experiment with setting theAndroidSdkBuildToolsVersion
MSBuild property to version 30.0.0 will need to use JDK 11.To do so:
Install a distribution of JDK 11 version 11.0.4 or lower, such as JetBrains Runtime jbrsdk build 520.13 or earlier.
On Windows, open Tools > Options in Visual Studio, select the Xamarin > Android Settings node, and set Java Development Kit Location to the root of the JDK 11 installation.
On macOS, open Visual Studio > Preferences , select the Projects > SDK Locations > Android node, open the Locations tab, and set the Java SDK (JDK) Location to the root of the JDK 11 installation.
๐ง Alternatively, to configure the JDK path per project, open the project file in Visual Studio or another text editor and set the
JavaSdkDirectory
MSBuild property to the root of the JDK 11 installation. For example:\<PropertyGroup\> \<JavaSdkDirectory\>C:\Program Files\jbrsdk\</JavaSdkDirectory\> \</PropertyGroup\>
Known Issues
- GitHub 4789: error XACLP7004: System.ArgumentException: Directory ... obj\Debug\javadocs...' does not appear to be an android doc reference directory. prevents using the JavaSourceJar Build Action in bindings projects.
- ๐ GitHub 4853: error XA0030: Building with JDK version
11.0.7
is not supported. prevents using the latest available OpenJDK 11 version, such as the latest build of the JetBrains Runtime.
๐ XA1023 warning for upcoming DX DEX compiler deprecation
Projects that have Dex compiler set to dx in the Visual Studio project property pages will now get a build warning:
warning XA1023: Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.
To resolve this warning, set the Dex compiler in the Visual Studio project property pages to d8 , or edit the project file in Visual Studio or another text editor and set the
AndroidDexTool
MSBuild property tod8
:\<PropertyGroup\> \<AndroidDexTool\>d8\</AndroidDexTool\> \</PropertyGroup\>
Background information
๐ Google has deprecated the DX DEX compiler in favor of the D8 DEX compiler. After February 1, 2021, DX will no longer be a part of the Android SDK or Android Studio. Project authors are encouraged to migrate their projects to D8 at their earliest convenience to prepare for this change.
โก๏ธ Updated XA0113 warning for Google Play submission requirements
The XA0113 warning has been updated to reflect the current minimum target version of Android 9 (API level 28) for submissions to the Google Play store. The following warning will now appear for projects that have an earlier version set under Compile using Android version: (Target Framework) in the Visual Studio project properties pages:
warning XA0113: Google Play requires that new applications and updates must use a TargetFrameworkVersion of v9.0 (API level 28) or above. You are currently targeting v8.0 (API level 26).
โก๏ธ Mono.Data.Sqlite SQLite version update
The version of SQLite used by Mono.Data.Sqlite in Xamarin.Android has been updated from 3.31.1 to 3.32.1, bringing in security fixes, improvements, and bug fixes.
JI_JAVA_HOME environment variable for custom Java JDK paths
Xamarin.Android will now look for the contents of an environment variable named
JI_JAVA_HOME
as another way to customize the Java JDK path used during the build. In cases where both theJI_JAVA_HOME
environment variable and theJavaSdkDirectory
MSBuild property are set to custom values, the MSBuild property takes precedence.In general, this environment does not need to be adjusted, but in certain special scenarios, having the option to customize the JDK path via an environment variable might provide useful flexibility.
๐ Issues fixed
IDE compatibility
- ๐ Developer Community 1038779: Starting in Visual Studio 2019 version 16.7 Preview 1, Visual Studio would abort unexpectedly when attempting to load or build certain Xamarin.Android projects configured to use AAPT2.
Application behavior on device and emulator
- Developer Community 1021788, GitHub 4727: Many typemap: unable to find mapping to a Java type from managed type messages were logged to the application output for running apps, in some cases causing Visual Studio to become unresponsive until the output window caught up. This issue was also fixed in Xamarin.Android 10.3.1.4.
- Developer Community 1030901, GitHub 4664: Localized resources from .resx files were not deployed when building and deploying from within Visual Studio to an attached device or emulator. (In contrast, clean builds on the command line worked as expected.) This issue was also fixed in Xamarin.Android 10.3.1.4.
๐ Application and library build and deployment
- Developer Community 955972 error APT2258: not well-formed (invalid token) prevented using accented characters or other non-ASCII UTF-8 characters in Android layout files that also contained custom views. This issue was also fixed in Xamarin.Android 10.3.1.4.
- GitHub 4152: Unable to read profile ... The system cannot find the file specified prevented the
FinishAotProfiling
MSBuild target from completing successfully if the location ofadb
was not in thePATH
environment variable. - GitHub 4542: error CS1681: You cannot redefine the global extern alias prevented building app projects successfully if the .csproj file included
global
in the<Aliases></Aliases>
metadata element of a referenced Xamarin.Android class library. - GitHub 4662: In projects configured to use the recently added
manifestmerger.jar
Android manifest merging option,tools:node="remove"
did not yet remove AndroidManifest.xml nodes generated by C# attributes in referenced library projects. - โก๏ธ GitHub PR 4779: error XA1011: Using ProGuard with the D8 DEX compiler is no longer supported. Please update
$(AndroidLinkTool)
tor8
. did not mention the corresponding term code shrinker that is used in the Visual Studio project property pages and did not mention thatAndroidLinkTool
is an MSBuild property.
Android API bindings
- ๐ GitHub 4752: error XAGJS7004: System.ArgumentException: Unsupported ForegroundServiceType value '9'. prevented using bitwise combinations of multiple values of
Android.Content.PM.ForegroundService
.
Application Mono Framework behavior on device and emulator
๐ This version of Xamarin.Android updates the Mono 6.12 runtime and class libraries from Commit 075c3f06 to Commit 87ef5557, adding 5 new commits.
- GitHub 4713: Starting in Xamarin.Android 10.3, SIGSEGV during
monodroid_typemap_java_to_managed
could cause apps to abort if the application was built with theAndroidEnablePreloadAssemblies
MSBuild property set tofalse
.
Installing
โก๏ธ To get the new version in Visual Studio, update Visual Studio:
- Visual Studio 2019 version 16.7 Preview 3 โ Visual Studio Installer
- Visual Studio 2019 for Mac 8.7 Preview 3 โ Visual Studio for Mac Installer with the Preview updater channel
For other scenarios, the latest commercial .vsix and .pkg installer packages can be found in the project README.
Open source
Xamarin.Android 10.4 is based on the open-source Xamarin.Android repositories:
- ๐ The Mono runtime and class library artifacts for this version come from the android-release-Darwin-*.7z archive generated by the Mono open-source build: archive-mono/job/2020-02 build #82.
- 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.