July 25th, 2019

Introducing AndroidX for Xamarin

Jon Douglas
Principal Program Manager

The Android Support Library has had a long history of over the last 7 years providing backwards compatibility to Android framework APIs. Over the years, this library has grown in adoption as the majority of Android apps in the Google Play Store use the Support Library in some fashion today.

However, it hasn’t always been straight-forward. As the Support Library grew in complexity, so did the inconsistencies regarding the naming convention of the library. Each library originally followed a naming convention that identifies the minSdkVersion your project must be greater than or equal to in order to use. For example, seeing the mention such as v7 appcompat. That means this support library will be backwards compatible up until Android API 7. With time, however, this minSdkVersion kept increasing to support modern Android devices. To which it, for example, increased to Android API 14 which led to confusion for Android Developers everywhere as v7 appcompat no longer meant it supported backwards to Android API 7.

Introducing AndroidX for Xamarin

To clear up this confusion, the Android team decided to refactor the Support Library into a new set of extension libraries known as AndroidX. Which includes simplified package names to better reflect each package’s content and it’s supported API levels. This has also provided a clear separation from what packages are bundled with the Android Operating System, and those that are an extension of it.

We’re delighted to bring you initial support for AndroidX packages today.

How This Affects You

Because AndroidX is a redesign of the Android Support Library, it includes migration steps that will affect Android applications built with the Android Support Library.

Package Name Change

The package names have been changed between the old and new packages. Below you can see an example of these changes:

Old New
android.support.** androidx.@
android.design.** com.google.android.material.@
android.support.test.** androidx.test.@
android.arch.** androidx.@
android.arch.persistence.room.** androidx.room.@
android.arch.persistence.** androidx.sqlite.@

For more details on package naming, see the following documentation.

Migration Tooling

There are two steps involved with migration that you’ll want to be aware of today.

  1. If your application includes any dependencies that have not been migrated to the AndroidX namespace, you’ll have to use our handy-dandy Android Support Library to AndroidX Migration package.
  2. If your application does not include any dependencies that require AndroidX namespace migration, you can use the AndroidX libraries on NuGet today.

Later this year, we will be providing you with AndroidX Migration Tooling inside Visual Studio where you can quickly migrate your existing project to fully use AndroidX.

AndroidX Preview NuGets

Starting today, you can use AndroidX Preview Packages on NuGet. You can find these packages listed on NuGet.

Introduction

Bonus: New Stable Google Play Services / Firebase Packages

Given that this has a complex dependency chain, we’ve also published new stable packages for Google Play Services and Firebase. You can expect to use 71.* versions today on NuGet:

Feedback

We’re continuously improving this experience and want to know your thoughts on it! For anything you believe is an issue with AndroidX and Xamarin, please file an issue on Developer Community.

Additionally, let us know if you have any suggestions for how we can improve the experience. Please also file a suggestion on Developer Community.

Finally, check out our Xamarin AndroidX Migration GitHub repository for some tips and tricks in using the package, known issues, and limitations!

Author

Jon Douglas
Principal Program Manager

Jon Douglas is a Principal Program Manager for NuGet at Microsoft. In his spare time he is most likely spending time with his family, performing comedy improv, or playing video games.

7 comments

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

  • Dávid Almási

    Hi, I guess it does not make too much sense to try, but still: When can we expect a production-grade release? By starting a new Xamarin Android project, it still comes with the old android support library dependencies. When will be AndroidX integrated into Visual Studio?

  • Osvaldo Santiago Estrada

    If we upgrade to use AndroidX, the .apk will increase the size?

  • Guillermo Gerard

    I’ve tried the migration but…..

    Now I’m getting:
    MSB4018: The “GenerateJavaStubs” task failed unexpectedly.
    System.IO.FileNotFoundException: Could not load assembly ‘Xamarin.Android.Support.Compat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=’. Perhaps it doesn’t exist in the Mono for Android profile?

    And of course, the file is there.

  • Xavier Pernot

    The AndroidX packages have been released by Google in August 2018. Xamarin bindings are still in a Preview mode with outstanding issues. When can we expect a Production-grade release for these bindings?

  • Mihails Kuzmins

    Is there any hope that Xamarin.AndroidX.Navigation package from the architecture components will be added to NuGet soon?

  • Algan, Can

    I am not able to locate androidx packages anymore, have they been pulled out?

    • surbhi pradhan

      Log in with a Microsoft Account using your Microsoft Id and password associated with the copy of MS office you have bought. If you don’t have a Microsoft account then open office/setup and select signup then creates an account.