AndroidX with Xamarin
How to get started developing apps with AndroidX using Xamarin.Android.
AndroidX is a major improvement to the original Android Support Library, which is no longer maintained. AndroidX packages fully replace the Android Support Library by providing feature parity and new libraries you can use in your Android applications.
AndroidX includes the following features:
- All packages inside AndroidX now have a consistent namespace starting with
androidx. This means all Android Support Library packages map to a corresponding
androidxpackages are separately maintained and updated. This means that you can update AndroidX libraries independently of each other.
- As of v28 of the Android Support Library, there will be no more releases. All development will be included in
The following list is required to use AndroidX features in Xamarin-based apps:
- Visual Studio - On Windows update to Visual Studio 2019 version 16.4 or later. On macOS, update to Visual Studio 2019 for Mac version 8.4 or later.
- Xamarin.Android - Xamarin.Android 10.0 or later must be installed with Visual Studio (Xamarin.Android is automatically installed as part of the Mobile Development With .NET workload on Windows and installed as part of the Visual Studio for Mac Installer)
- Java Developer Kit - Xamarin.Android 10.0 development requires JDK 8. Microsoft's distribution of the OpenJDK is automatically installed as part of Visual Studio.
- Android SDK - Android SDK API 28 or higher must be installed via the Android SDK Manager.
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:
For more details on package naming, see the following documentation.
There are three migration steps that you'll want to be aware of for your application.
- If your application includes Android Support Library namespaces and you'd like to migrate them to AndroidX namespaces, you can use our Migrate to AndroidX IDE tooling to take care of most namespace scenarios.
Enable the AndroidX Migrator via Tools > Options > Xamarin > Android Settings inside Visual Studio 2019 (you can skip this step on Visual Studio for Mac).
Right-click your project and Migrate to AndroidX.
You will need to make some manual namespace changes for scenarios the tool doesn't cover. While we will map the correct package for you, it is encouraged that you to take a look at the official artifact mappings and class mappings to help your project migration.
- If your application includes any dependencies that have not been migrated to the AndroidX namespace, you'll have to use the 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.
- Certain architecture packages within AndroidX will conflict with the Support Library versions. To fix this, you should use the AndroidX version of these packages and remove the Support Library version. For example, if you are referencing
Xamarin.Android.Arch.Work.Runtimein your project, it will conflict with the types of the newly added
This article introduced AndroidX and explained how to install and configure the latest tools and packages for Xamarin.Android development with AndroidX. It provided an overview of what AndroidX is. It included links to API documentation and Android Developer topics to help you get started in creating apps using AndroidX. It also highlighted the most important AndroidX behavior changes and troubleshooting topics that could impact existing apps.