Xamarin.Forms and Essentials now target Android 13 (in Preview)
We are excited to announce that Xamarin.Forms and Xamarin.Essentials now target Android 13!
As of August 2023, new Android apps that are distributed through the Google Play Store will have to target at least Android 13. In a continued effort to keep supporting Xamarin.Forms, we have now updated Xamarin.Forms and Xamarin.Essentials to target MonoAndroid13 by default.
Since this is a bigger update than usual, we are putting out this preview release first.
.NET 7 and .NET MAUI already support Android 13. We encourage all new applications to begin with .NET MAUI since Xamarin support will end May 1, 2024. This release for Xamarin is intended to assist you through your upgrade transition to .NET MAUI. For more information about upgrading to .NET MAUI review our upgrade guides and check out the newly released .NET Upgrade Assistant extension for Visual Studio 2022.
Compatibility with AndroidX and Other Packages
The AndroidX binding packages and other dependencies you might have in your Xamarin.Forms app were already updated to target Android 12. Because of this, it was not possible to updated these packages beyond a certain point.
The dependencies that we have in place for Xamarin.Forms have now been updated to the latest available versions at this time. The one exception is Xamarin.AndroidX.Lifecycle, updating this package to 2.6.1 causes an issue which we are currently investigating.
Additionally, after updating you might see warnings in your build output that state something like “unknown enum constant Scope.LIBRARY_GROUP_PREFIX”. At the time of writing this is being investigated. This should however not prevent you from building your project.
Target Android 13 in your Xamarin.Forms Project
To begin targeting Android 13 with Xamarin.Forms and Xamarin.Essentials, follow these simple steps:
- Make sure that your machine has Xamarin.Android 13 installed, if you have Visual Studio 2022 17.3+ (released August 2022), you should be good.
- Update your Xamarin.Forms and Xamarin.Essentials NuGet packages to the latest version. Note that these versions are in preview right now, make sure to check the “Include prelease” checkbox in your NuGet package management screen. The versions you want to look for are Xamarin.Forms 220.127.116.1199-pre1 and Xamarin.Essentials 1.8.0-preview1.
- In your Android project’s
AndroidManifest.xml, update the
- Update your Android project to target Android 13. You can do this by manually editing the Android project csproj file and set the
v13.0or do it through the Visual Studio user interface.
- Rebuild your project and start testing if everything works as expected.
Xamarin Support Policy
While this change should make sure that you can keep working on your Xamarin.Forms apps a little longer, please do keep in mind that the support for all Xamarin products is ending on May 1st, 2024 as per our official support policy. For more detailed information, please read David’s blog post about the support timeline.
The future or cross-platform development based on C# and .NET is with .NET MAUI. For new projects we recommend to start with .NET MAUI directly. For existing projects, begin your upgrade with the .NET Upgrade Assistant that will help you upgrade your Xamarin.Forms projects to .NET MAUI.
A quote from the support policy:
Xamarin support will end on May 1, 2024 for all classic Xamarin SDKs. Android 13 will be the final version classic Xamarin.Android will target.
Have a look at our .NET MAUI documentation to help get you started.
Start Testing Today
As always, we appreciate your feedback and encourage you to report any issues on our GitHub repository.
If no major issues arise from the changes in these preview versions, we will release a stable version ahead of Google’s August 2023 deadline.