AndroidX Overview
AndroidX is the open-source project that the Android team uses to develop, test, package, version and release libraries within Jetpack.
AndroidX is a major improvement to the original Android Support Library. Like the Support Library, AndroidX ships separately from the Android OS and provides backward-compatibility across Android releases. AndroidX fully replaces the Support Library by providing feature parity and new libraries.
AndroidX includes the following features:
- All packages in AndroidX live in a consistent namespace starting with the string androidx. The Support Library packages have been mapped into the corresponding androidx.* packages. For a full mapping of all the old classes and build artifacts to the new ones, see the Package Refactoring page.
- Unlike the Support Library, AndroidX packages are separately maintained and updated. The androidx packages use strict Semantic Versioning starting with version 1.0.0. You can update AndroidX libraries in your project independently.
- All new Support Library development will occur in the AndroidX library. This includes maintenance of the original Support Library artifacts and introduction of new Jetpack components.
As in every Android project you build on Android Studio, you must have seen these support libraries in your build.gradle file starting with com.android.support.
- com.android.support:appcompat-v7
- com.android.support:recyclerview-v7
And after AndroidX implementation, these libraries have a starting package like androidx. instead of com.android.support.
- androidx.appcompat:appcompat
- androidx.recyclerview:recyclerview
You can find the complete mapping of all support libraries here
Migrate to AndroidX
AndroidX replaces the original support library APIs with packages in the androidx namespace. Only the package and Maven artifact names changed and class, method, and field names did not change.
Note: Before you migrate, bring your app up to date. We recommend updating your project to use the final version of the support library: version 28.0.0. This is because AndroidX artifacts with version 1.0.0 are binary equivalent to the Support Library 28.0.0 artifacts.
Migrate an existing project using Android Studio
For this you must have Android Studio 3.2+ or above. Now open project that you want to migrate to AndroidX.
1. Go Refractor->Migrate to AndroidX as shown in below image.
2. After selecting this, Android Studio will ask you if you want to save a backup copy of your project in a .zip file, because In case of any problems, you can get your project back.
After migrate, these two flags set automatically to true after refactoring in your gradle.properties.
- android.useAndroidX=true: This will ensure that Android plugins use the appropriate AndroidX library instead of support libraries.
- android.enableJetifier=true: This will automatically convert third party libraries to AndroidX.
Hope you got about AndroidX, some androidx components you can find here