How to Migrate to AndroidX

In this article, we will refactor an existing support library project to Androidx. The package names, dependency names change and rest (like class names, method names) stays the same.

1) Click Refactor and then Migrate to AndroidX.


2) Click Migrate and make sure the back up option is selected.


3) Provide a location to save the backup of the entire project.


4) Verify the dependencies, the package names that are getting refactored and then finally Click Refactor.


Once finished, you can see the updated package names and dependency names. In addition to that, the Refactor option adds android.useAndroidX=true and android.enableJetifier=true to file. This converts the support library package names of the non-convert third-party libraries.

This process is fairly simple but there might be issues faced and the refactor may fail, so backing up the project or tracking the changes using git is necessary to avoid the project loss.

Popular posts from this blog

How to Read Metadata from AndriodManifest File

How to Set an Android App as a Default Dialer

Add Spacing to Recycler View Linear Layout Manager Using Item Decoration

How to Change Material Chip Text Size, Text Style and Font

Create Assets Folder, Add Files and Read Data From It