Introducing AndroidX for Xamarin

Jon

July 25th, 2019

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.

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.

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. 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!