AndroidX is the latest Android support library package and is an improved version of older support libraries. Android Studio seamlessly supports migration of Android code with support library to AndroidX.
To refactor the code and migrate to new AndroidX package follow the steps as given below.
Open Android Studio & open your project that you want to migrate.
Click on the Refactor and select Migrate to AndroidX
Click on Migrate which in turn will search for all references of older support library usages. The preview of the changes will be shown in the result window.
Click on Do Refactor
Android Studio will search and replace all the components and map to related AndroidX package.
This will also update app’s build.gradle
file and replace support packages with AndroidX dependencies.