Skip to content

Releases: dotnet/android

.NET 7, Android 33.0.46

11 Apr 15:27
Compare
Choose a tag to compare

These changes shipped alongside Visual Studio 2022 17.6 Preview 3.

You can also access this release via dotnet workload update.

What's Changed

Full Changelog: 33.0.26...33.0.46

.NET 8 Preview 2, Android 34.0.0-preview.2.187

14 Mar 17:13
Compare
Choose a tag to compare

How to install?

Download the .NET 8 Preview 2 SDK, followed by:

> dotnet workload install android
...
Successfully installed workload(s) android.

To verify installation:

> dotnet workload list

Installed Workload Id      Manifest Version                            Installation Source
--------------------------------------------------------------------------------------------
android                    34.0.0-preview.2.187/8.0.100-preview.2      SDK 8.0.100-preview.2

What's Changed

Full Changelog: 34.0.0-preview.1.157...34.0.0-preview.2.187

.NET 8 Preview 1, Android 34.0.0-preview.1.157

21 Feb 21:09
Compare
Choose a tag to compare

How to install?

Download the .NET 8 Preview 1 SDK, followed by:

> dotnet workload install android
...
Successfully installed workload(s) android.

To verify installation:

> dotnet workload list

Installed Workload Id      Manifest Version                            Installation Source
--------------------------------------------------------------------------------------------
android                    34.0.0-preview.1.157/8.0.100-preview.1      SDK 8.0.100-preview.1

What's Changed

Read more

.NET 7 (.NET MAUI SR 2), Android 33.0.26

19 Jan 23:00
Compare
Choose a tag to compare

These changes shipped alongside Visual Studio 2022 17.5 Preview 3 and .NET MAUI 7.0.58.

You can also access this release via dotnet workload update.

What's Changed

Full Changelog: 33.0.4...33.0.26

.NET 7 GA, Android 33.0.4

09 Nov 16:03
8f1d9a4
Compare
Choose a tag to compare

What's Changed

Full Changelog: 33.0.0-rc.1.151...33.0.4

.NET 7 RC 1, Android 33.0.0-rc.1.151

09 Nov 16:04
b9389dc
Compare
Choose a tag to compare
Pre-release

Android 13 (API-33) Bindings

Android 13 adds a number of new APIs in
API-33, which are now available when
by setting $(TargetFramework)=net7.0-android33.0.

App build system changes

Runtime Optimizations

Read more

Xamarin.Android 11.2.99.192 [11.3 Preview]

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

Application build and deployment

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Preview bindings for Android 12 Developer Preview 2

This version includes preview bindings for the
second Developer Preview of Android 12 from Google.
See the Android 12 Developer Preview documentation for
additional information about the behavior and API changes in this new Android version.
To try the bindings for the new APIs in a Xamarin.Android project, set the
$(TargetFrameworkVersion) to v11.0.99 in the .csproj file:

<TargetFrameworkVersion>v11.0.99</TargetFrameworkVersion>

Binding project build

Notable issues fixed

Xamarin.Android 11.2.2.1

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

Installing

What's new in Xamarin.Android 11.2

Xamarin.Android 11.2 releases

Corresponding Visual Studio 2019 Preview release notes

March 2, 2021 — Xamarin.Android 11.2.0.21

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

In Xamarin.Android 11.2.0.21

Rewritten fast deployment system

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

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

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

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

See the Fast Deployment documentation for more details.

Known Issue: Fast Deployment and .mdb files

The new Fast Deployment mechanism may fail with:

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

See also: #5631

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

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

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

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

Application and library build and deployment

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

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

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

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

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

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

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0"   package="com.xamarin.android.helloworld">
      <uses-sdk android:targetSdkVersion="30" />
      <!-- ... -->
      <queries>
        <package android:name="Mono.Android.DebugRuntime" />
        <package android:name="Mono.Android.Platform.ApiLevel_30" />
      </queries>
    </manifest>

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

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

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

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

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

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

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

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

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

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

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

Read more

Xamarin.Android 11.1.99.168 Preview

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

What's new in Xamarin.Android 11.2

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

Corresponding Visual Studio 2019 Preview release notes

What's new

Deprecations, removals, and default configuration changes

Build and deployment performance

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

Rewritten fast deployment system

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

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

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

See Documentation for more details.

Deprecation of DebugType full and pdbonly

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

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

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

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

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

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

Deprecation of AAPT in favor of AAPT2

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

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

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

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

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

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

Better file association for Android manifest syntax errors

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

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

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

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

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

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

UseShortFileNames=false is no longer supported

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

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

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

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

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

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

Notable issues fixed

Application and library build and deployment

Read more

Xamarin.Android 11.1.0.17

10 Nov 19:34
Compare
Choose a tag to compare

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

Corresponding Visual Studio 2019 release notes

What's new compared to Xamarin.Android 11.0

Deprecations, removals, and default configuration changes

Build and deployment performance

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

android:extractNativeLibs set to "true" by default

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

According to the Android documentation, extractNativeLibs affects APK size and install size:

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

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

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

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

Corrected garbage collection behavior for Android bindings and bindings projects

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

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

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

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

apksigner from Android SDK Build-Tools 30.0.3 now included

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

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

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

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

Default Android SDK Platform-Tools version update to 30.0

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

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

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

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

Deprecation of Android Wear references in app projects

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

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

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

Soft deprecation of undocumented ProguardConfigFiles MSBuild property

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

Read more