May 15th, 2023

Xamarin.Forms and Essentials now target Android 13 (in Preview)

Gerald Versluis
Senior Software Engineer

We are excited to announce that Xamarin.Forms and Xamarin.Essentials now target Android 13!

The Android 13 logo

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:

  1. 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.
  2. 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 5.0.0.2599-pre1 and Xamarin.Essentials 1.8.0-preview1.
  3. In your Android project’s AndroidManifest.xml, update the targetSdkVersion to 33 (Android 13).
  4. Update your Android project to target Android 13. You can do this by manually editing the Android project csproj file and set the TargetFrameworkVersion node to v13.0 or do it through the Visual Studio user interface.
  5. 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.

Happy coding!

Author

Gerald Versluis
Senior Software Engineer

Gerald Versluis is a software engineer at Microsoft on the .NET MAUI team.

13 comments

Discussion is closed. Login to edit/delete existing comments.

  • MitchBomcanhao

    Hi Gerald, seeing as google will require us to target api 33 by august 31st, will we have a new release of these components in good time?
    I have tried xf+essentials and things seemed to do ok - had to do some minor changes to permissions related stuff but once I was done with them it appeared to work ok on an android 13 simulator and some older android devices. Couldn't allocate too much time...

    Read more
    • Gerald VersluisMicrosoft employee Author

      Thanks for sharing your experience! We will definitely make sure a stable release is available before then.

  • Kurt Coleman

    Hi Gerald, thanks for this. Any idea when a stable release will be published?

    • Gerald VersluisMicrosoft employee Author

      Hey Kurt!

      Did you try it, did everything work as expected for you? The more positive feedback we get, the better indication we will have to promote this to a stable release.

      • Kurt Coleman

        Hi Gerald. I have not found any issues in my testing.

  • אלון רום

    thanks for the post, can you share when a stable version will be released and not a preview?

    • Gerald VersluisMicrosoft employee Author

      Thanks! With your feedback that will go faster! If you test out this preview on your app right now and let me know if everything still works as expected, that will help build confidence that we are not breaking any people with this update and that means we can release it as stable faster. I don’t have a concrete date for you at this time.

  • Anderson Damasio

    It’s great to know that there’s an investment in Xamarin Forms. We know that there are a large number of developers with the platform.
    Congratulations

  • Rafal Hały

    Android 13 = API 33

    • Gerald VersluisMicrosoft employee Author

      Thanks! Yeah maybe I should add that. Still need to always make the connection between the two 😅

      • Rafal Hały · Edited

        Maybe you can change that targetsdk should be set to 33 not to 31😉

      • Gerald VersluisMicrosoft employee Author

        Oh that’s what you meant, good spot, will change that thanks!