Xamarin.Android 10.0.99.100
Pre-releaseXamarin.Android 10.0.99.100 was released as part of Visual Studio 2019 version 16.4 Preview 1.
Corresponding Visual Studio 2019 Preview release notes
What's new
- Build and deployment performance
- Mono Framework version update to 6.6
- Binding project improvements with C# 8.0 for Java interface members
- Environment variables and files for package signing passwords
- Mono.Data.Sqlite SQLite version update
- Issues fixed
- Known issues
Build and deployment performance
- GitHub PR 3296: Remove an unneeded LINQ
Distinct()
call from theResolveLibraryProjectImports
task. This saved about 25 milliseconds for each run of the task in a test environment. - GitHub PR 3354: Improve the behavior of the
_GenerateJavaStubs
task so that it is skipped as expected during an incremental build of a Xamarin.Android bindings library project when no files have changed. - GitHub PR 3359: Allow the managed linker to read the input assemblies from their original locations instead of copying them to an intermediate obj\Debug\*\linksrc directory beforehand. This removes the
_CopyMdbFiles
,_CopyPdbFiles
, and_CopyIntermediateAssemblies
targets. Those targets previously took approximately 150 milliseconds for a test Xamarin.Forms app when only one XAML file was changed between builds. Depending on system speed and antivirus settings, the total savings can be greater. For example, for one tested example project and environment, the overall build time decreased from about 33 seconds to about 30 seconds. - GitHub PR 3528: Correct the
Inputs
andOutputs
for theSetupDependenciesForDesigner
and_ResolveLibraryProjectImports
targets, and add an option for theJavac
task to skip creating a classes.zip file when running for the designer. In addition to improving the designer responsiveness, this also allows projects to skip the_CompileToDalvikWithDx
or_CompileToDalvikWithD8
target in incremental builds when only an Android XML layout file has changed. For example, in one test of an example project, the_CompileToDalvikWithD8
target previously took roughly 4.6 seconds for this scenario, and now it is skipped completely. - GitHub PR 3535, GitHub PR 3600: Add and switch to a new specialized
LinkAssembliesNoShrink
MSBuild task for Debug builds. In the Debug scenario, where the managed linker is not set to remove any types, the managed linker only needs to run a quick step to adjust abstract methods in Xamarin.Android assemblies. The new specialized task reduced the time for the_LinkAssembliesNoShrink
target from about 340 milliseconds to about 10 milliseconds for a test Xamarin.Forms app when one line of a XAML file was changed between builds. - GitHub PR 3555: Improve the behavior around the
_BuildApkFastDev
target so it is skipped correctly when a Xamarin.Android app project has changes that do not require building a new APK. For example, changes to user-defined classes do not require a new APK unless they inherit fromJava.Lang.Object
, but the target was running if any class in the app project changed. Correcting this behavior saved roughly 2.5 seconds for the deployment time of a small test Xamarin.Android app on a fast build machine.
Mono Framework version update to 6.6
This version of Xamarin.Android updates the Mono runtime and class libraries from Mono 6.4 to Mono 6.6 Commit 29b1ac19, adding about 700 new commits.
Binding project improvements with C# 8.0 for Java interface members
In Android 7.0 Nougat (API level 24) and higher, some Android libraries started using new Java 8 language features, including:
- Default interface methods
- Static interface methods
- Interface constants
C# 8.0 introduces a similar default interface members language feature. Starting in Xamarin.Android 10.1, Xamarin.Android bindings projects can now take advantage of this new capability to surface C# APIs that more closely match the original APIs in the Java libraries.
To try this functionality with your bindings project, set the $(LangVersion)
MSBuild property to preview
and the $(_EnableInterfaceMembers)
MSBuild property to true
in your .csproj file:
<PropertyGroup>
<LangVersion>preview</LangVersion>
<_EnableInterfaceMembers>true</_EnableInterfaceMembers>
</PropertyGroup>
Note that enabling this new option only adds members. It does not remove the previous style of C# bindings for these kinds of Java APIs.
Environment variables and files for package signing passwords
Until now, the Keystore Password and Alias Password settings in the Android Package Signing section of the Visual Studio project property pages only supported literal password values. Starting in Xamarin.Android 10.1, these settings now support a new syntax that allows entering environment variable names or file names instead. These options provide a way to prevent the passwords from appearing in build logs.
To use an environment variable name, prefix the name with env:. To use a local file path, prefix the path with file:.
For example, to use an environment variable named AndroidSigningPassword for both settings, enter env:AndroidSigningPassword under both the Keystore Password and Alias Password settings. This sets the corresponding $(AndroidSigningStorePass)
and $(AndroidSigningKeyPass)
MSBuild properties in your .csproj file:
<PropertyGroup>
<AndroidSigningStorePass>env:AndroidSigningPassword</AndroidSigningStorePass>
<AndroidSigningKeyPass>env:AndroidSigningPassword</AndroidSigningKeyPass>
</PropertyGroup>
To use a file located at C:\Users\Windows User\AndroidSigningPassword.txt for both settings, enter file:C:\Users\Windows User\AndroidSigningPassword.txt. This again sets the corresponding $(AndroidSigningStorePass)
and $(AndroidSigningKeyPass)
MSBuild properties in your .csproj file:
<PropertyGroup>
<AndroidSigningStorePass>file:C:\Users\Windows User\AndroidSigningPassword.txt</AndroidSigningStorePass>
<AndroidSigningKeyPass>file:C:\Users\Windows User\AndroidSigningPassword.txt</AndroidSigningKeyPass>
</PropertyGroup>
Note that if the same file is specified for both settings, the file must contain two lines. The first line must be the keystore password, and the second line must be the alias password.
Mono.Data.Sqlite SQLite version update
The version of SQLite used by Mono.Data.Sqlite in Xamarin.Android has been updated from 3.27.1 to 3.28.0, bringing in several improvements and bug fixes.
Issues fixed in Xamarin.Android 10.0.99.100
Application and library build process
-
Developer Community 237753, Developer Community 554407, GitHub 3407: Errors similar to [aot-compiler stderr] Cannot open assembly 'Files': No such file or directory. or Illegal characters in path ... at Xamarin.Android.Tasks.Aot could prevent projects using Enable Startup Tracing or AOT Compilation from building successfully on volumes where Windows 8.3 file name creation was disabled. Xamarin.Android 10.1 now uses a response file to pass command line parameters to the tooling for these steps, so having 8.3 file name creation enabled is no longer required.
-
Developer Community 618007, GitHub 3294: Could not find android.jar for API Level 28. ... Either install it in the Android SDK Manager (Tools > Open Android SDK Manager...) error message did not indicate the correct menu location for the Android SDK Manager on Windows.
-
Developer Community 679868: Errors like error APT0000: resource layout/headerLayout (aka com.contoso.androidapp:layout/headerLayout) not found. or error APT0000: No resource found that matches the given name (at 'headerLayout' with value '@layout/headerLayout'). prevented projects from building successfully if an Android layout used the capitalized suffix Layout in a reference to another layout, unless the name was rectLayout, roundLayout, or actionLayout. Xamarin.Android 10.1 now automatically lowercases any value that ends with Layout when used with attributes from the
http://schemas.android.com/apk/res-auto
XML namespace. -
GitHub 2023: Imprecise error XA0000: Unhandled exception: System.FormatException: Input string was not in a correct format. was shown if the Version number in the Android Manifest (or Android Application on macOS) section of the Visual Studio project property pages was set to a value that could not be parsed as an integer. Xamarin.Android 10.1 now shows a more specific error message for this scenario.
-
GitHub 2848: Unclear messages similar to Unable to remove directory "obj\Debug\90\android\bin\classes". Could not find a part of the path 'AccessibilityManagerCompat_AccessibilityStateChangeListenerImplementor.class' and Failed to create JavaTypeInfo for class: Android.Support.V4.View.AsyncLayoutInflater/IOnInflateFinishedListenerImplementor due to System.IO.DirectoryNotFoundException: Could not find a part of the path '... AsyncLayoutInflater_OnInflateFinishedListenerImplementor.java'. were shown when attempting clean or build projects where one of the build steps used a path length close to the Windows API maximum path length limitation of 260 characters. Xamarin.Android 10.1 will now retry certain failing steps using the
\\?\
prefix and provide a more specific error message about the path length limitation if that also fails. -
GitHub PR 3368: Messages from the lint tool when the
$(AndroidLintEnabled)
MSBuild was set totrue
would include paths to intermediate build versions of Android resource files rather than paths to the original resource files. -
GitHub 3370: Starting in Xamarin.Android 10.0, warning XA4306: R8 does not support `MultiDexMainDexList` files was shown when building projects that had the Code shrinker set to r8, Enable Multi-Dex enabled, and Minimum Android version set to at least Android 5.0 Lollipop (API level 21), even if no
@(MultiDexMainDexList)
items were set. -
GitHub 3477: error MSB4018: The "ConvertCustomView" task failed unexpectedly. ... System.NullReferenceException incorrectly prevented building in some scenarios where the
ConvertCustomView
task could in fact just skip over thenull
object. -
GitHub PR 3501: Xamarin.Android did not yet produce a warning if Visual Studio invoked one of the Xamarin.Android MSBuild targets while another target was already running in parallel. Xamarin.Android 10.1 now emits a XA5302 warning in this case so that the Xamarin.Android team can monitor how often this happens and how often it is associated with other build issues. If you need to suppress this warning, you can add it to the
$(MSBuildWarningsAsMessages)
MSBuild property in your .csproj file:<PropertyGroup> <MSBuildWarningsAsMessages>XA5302</MSBuildWarningsAsMessages> </PropertyGroup>
-
GitHub PR 3523: Libraries that used the MSBuild.Sdk.Extras NuGet package for the project SDK and that targeted a Xamarin.Android target framework like MonoAndroid90 would by default add an unexpected extra subdirectory for the version number in the output path: bin\Debug\monoandroid90\90\Library.dll.
-
GitHub 3547: error ANDKT0000: keytool error: java.lang.Exception: Key pair not generated, alias <androiddebugkey> already exists could prevent projects from building successfully under system accounts, such as when building in certain continuous build environments. Xamarin.Android 10.1 now skips the attempt to create a debug keystore in Release configurations if the Sign the .APK file using the following keystore details. setting is enabled in the Android Package Signing section of the Visual Studio project properties pages. This setting corresponds to the
$(AndroidKeyStore)
MSBuild property in the .csproj file. -
GitHub PR 3561: Starting in Xamarin.Android 10.0, the
_GenerateJavaStubs
target could run during builds where it wasn't needed if any of the previous builds had involved a change to a class that inherited fromJava.Lang.Object
. -
GitHub 3562: Starting in Xamarin.Android 10.0, building a Xamarin.Android app that included an embedded Android Wear app would rerun a number of expensive MSBuild tasks even when the outputs were already up-to-date.
-
GitHub PR 3577, GitHub PR 3599: Xamarin.Android used one generic APT0000 code for the majority of the errors and warnings that occur when running the Android AAPT and AAPT2 command line tools. Xamarin.Android 10.1 now checks for a large list of warning and error message fragments from AAPT and AAPT2 and assigns them to unique APT message codes so that the Xamarin.Android team can monitor how often users encounter each of the messages when building Xamarin.Android projects.
-
GitHub PR 3609: The Xamarin.Android MSBuild tasks allowed unhandled exceptions to propagate to MSBuild by default, meaning that any build failure caused by an unhandled exception in a task was assigned to the generic MSB4018 error code. Xamarin.Android 10.1 now uses unique error code prefixes for each of its MSBuild tasks and several unique error code numbers for different exception types so that the Xamarin.Android team can monitor which exception types and tasks most often cause build failures in user projects.
Application behavior on device and emulator
- GitHub PR 3458:
Java.Lang.AbstractMethodError
was thrown if an app attempted to invoke a C# 8.0 default interface member on a subclass ofJava.Lang.Object
. - GitHub 3498: Writing to the
System.IO.Stream
returned byApplication.Context.ContentResolver.OpenOutputStream()
completed without error but did not write any bytes to the output location. - GitHub 3451: Errors similar to 'dlopen failed: "/data/app/com.contoso.androidapp-AAAAAAAAAAAAAAAAAAAAAA==/lib/x86/libe_sqlite3.so" has unexpected e_machine: 40 (EM_ARM)' ... System.DllNotFoundException: e_sqlite3 could prevent using unmanaged libraries successfully in apps that had an Android ABI name like x86 in one of the intermediate build paths such as
$(IntermediateOutputPath)
. - GitHub 3596: Strings from .resx files were not localized in apps built with
$(AndroidPackageFormat)
set toaab
. - GitHub 3598: Errors similar to Java.IO.IOException: This file can not be opened as a file descriptor; it is probably compressed could occur when attempting to use binary assets in apps built with
$(AndroidPackageFormat)
set toaab
.
Android API bindings
- GitHub PR 3102:
Android.Views.Accessibility.Action
did not include the[Flags]
attribute, so using bitwise operators on it would produce warnings in static analysis tools. - GitHub 3180:
Android.Views.MetaKeyStates
did not yet include an enum member for 0. - GitHub 3508:
Android.Bluetooth.ProfileType
did not yet include an enum member for the newHearingAid
value introduced in Android 10 (API level 29).
Known issues in Xamarin.Android 10.0.99.100
- GitHub 3619:
error XA3001: Could not AOT the assembly due to [aot-compiler stderr] '""C:\Program' is not recognized as an internal or external command prevents projects that use Enable Startup Tracing or AOT Compilation from building successfully on Windows if they have armeabi-v7a selected in Advanced > Supported architectures under the Android Options section of the Visual Studio project property pages.
Feedback
Your feedback is important to us. If there are any problems with this release, check our GitHub Issues, Xamarin.Android Community Forums and Visual Studio Developer Community for existing issues. For new issues within the Xamarin.Android SDK, please report a GitHub Issue. For general Xamarin.Android experience issues, let us know via the Report a Problem option found in your favorite IDE under Help > Report a Problem.
Contributors
A big Thank You! to external contributors who made improvements in this release:
- Alexander Gayko (@AdmiralSnyder), GitHub PR 3102: Add the
[Flags]
attribute toAndroid.Views.Accessibility.Action
, so that using bitwise operators on it does not produce warnings in static analysis tools. - Sam (@SamuelDebruyn), GitHub PR 3518: Fix the
mingw-w64
Homebrew dependency version constraint for the xamarin-androidmake prepare
source build step on macOS so thatmake prepare
can be run more than once on the same development environment.
OSS core
The corresponding open-source build without commercial features is xamarin-android-d16-4 build #4.