Xamarin.Android 10.0.0.40
Pre-releaseXamarin.Android 10.0.0.40 was released as part of Visual Studio 2019 version 16.3 Preview 3 and to the Preview updater channel of Visual Studio 2019 for Mac version 8.3 Preview.
Corresponding Visual Studio 2019 Preview release notes
What's new
Enable Startup Tracing no longer requires the Android NDK
The new Enable Startup Tracing option introduced in Visual Studio Enterprise 2019 version 16.2 no longer requires an Android NDK installation. Xamarin.Android now includes its own versions of the as
, ld
, and strip
utilities that it uses to compile the startup methods to unmanaged code when Enable Startup Tracing is enabled. Additionally, the Enable Startup Tracing option is now available in the project property pages for all editions of Visual Studio.
To try this feature, configure the project to use Enable Startup Tracing in the Android Options section of the Visual Studio project property pages for the Release configuration. This sets the $(AndroidEnableProfiledAot)
MSBuild property to true
in your .csproj file:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
</PropertyGroup>
For Visual Studio Enterprise users, note that this change also means the AOT Compilation option no longer requires the Android NDK. In contrast, the Use LLVM Optimizing Compiler option still does require the Android NDK.
Issues fixed in Xamarin.Android 10.0.0.40
Application and library build process
- GitHub 2584: Starting in Xamarin.Android 9.2, "Error processing method: 'System.Void BatchStepSensor.BatchStepSensorFragment::OnSaveInstanceState(Android.OS.Bundle)'" could occur if the Compile using Android version: (Target Framework) setting had been changed between two successive builds.
- GitHub 3083: Projects that had both Use incremental packaging system (aapt2) and Generate one package (.apk) per selected ABI enabled and that had Compile using Android version: (Target Framework) set to Android 7.1 or lower would fail to build due to "The "BuildApk" task failed unexpectedly... Could not find file 'obj\Release\71\android\bin\packaged_resources-armeabi-v7a."
- GitHub 3276: "The "GenerateJavaStubs" task failed unexpectedly. System.ArgumentNullException ... at Mono.Cecil.AssemblyNameReference.Parse(String fullName)" prevented projects from building successfully if they tried to use an
ApplicationAttribute.NetworkSecurityConfig
property on a customAndroid.App.Application
subclass. - GitHub 3322: Starting in the Xamarin.Android 9.5 preview, errors similar to "error MSB4018: The "LinkAssemblies" task failed unexpectedly. ... System.IO.FileNotFoundException: Could not load assembly" prevented successful completion of the build when attempting to use the old Run Code Analysis static style of code analysis.
- GitHub PR 3327: Errors similar to "APT0000: Invalid file name: It must contain only [^a-zA-Z0-9_.-]+" could prevent projects from building successfully if they used
LogicalName
metadata on Android resources and had Use incremental packaging system (aapt2) enabled. - GitHub PR 3430: The Xamarin.Android build process added a trailing
\
to certain properties such as$(AndroidNdkDirectory)
and$(AndroidSdkDirectory)
even when they were set to the empty string. This was a compatibility issue for upcoming IDE features. - GitHub PR 3445: The Java compilation build step did not yet have a dedicated error code for failures when running
javac
. - GitHub 3454: In Xamarin.Android 9.4.1.0 and Xamarin.Android 10.0.0.4, the fix for GitHub 3263 unintentionally preserved additional types during managed linking, resulting in APK files that were about 7 megabytes larger than expected, depending on which libraries the app used.
- GitHub PR 3463: Errors similar to "error: class Class1 is public, should be declared in a file named Class1.java" prevented incremental builds from completing successfully if a custom subclass of
Java.Lang.Object
was changed by capitalizing or lowercasing some letters of the class name between builds. - GitHub 3494: Errors similar to "error APT0000: resource ... not found." could prevent builds from completing successfully until the project was cleaned if a build was started shortly after a layout file was changed.
Application Mono Framework behavior on device and emulator
This version of Xamarin.Android updates the Mono 6.4 runtime and class libraries from Commit 17ac7dcf to Commit 6434153d, adding 32 new commits.
Fixes included for issues reported with Xamarin.Android applications:
- Developer Community 668413, GitHub 3426: Starting in Xamarin.Android 9.4, errors similar to "System.UnauthorizedAccessException: Access to the path is denied. ---> System.IO.IOException: Operation not permitted" could prevent copying files successfully or reading from one file stream while writing to another.
- GitHub 3388: Starting in Xamarin.Android 9.4,
DllImport
could fail for certain unmanaged libraries, resulting inDllNotFoundException
exceptions.
Application behavior on device and emulator
- GitHub 3395: In apps built using AAPT2, managed Resource.Styleable IDs were incorrect when a
<declare-styleable>
contained more than ten<attr>
elements. This could result in absent or incorrect resource content in running apps.
Android API bindings
- GitHub 3313: The Xamarin.Android API bindings for
AudioRecord
did not yet inherit fromAudioRouting
, so theAudioRouting.OnRoutingChangedListener
API introduced in Android 7.0 Nougat (API level 24) was not yet available viaAudioRecord
. Starting with the Xamarin.Android bindings for Android 10.0 (API level 29), theAudioRouting.OnRoutingChangedListener
API is now available viaAudioRecord
.
Xamarin.Android SDK installation
- GitHub 3457: Starting in Xamarin.Android 9.4, the Xamarin.Android SDK .pkg installer package for macOS changed how it created symlinks in the /Library/Frameworks/Xamarin.Android.framework/ install location. This broke a special usage scenario where some users might have occasionally installed two versions of the Xamarin.Android SDK into the Xamarin.Android.framework/ directory and switched between the versions by changing the Versions/Custom symlink. That special usage now behaves as before.
OSS core
The corresponding open-source build without commercial features is xamarin-android-d16-3 build #51.
Both the commercial build and the open-source build use the Mono and libzip artifacts from the bundle*.7z archive generated by the earlier open-source build: xamarin-android-d16-3 build #49.