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.

refactor-migrate-androidx

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

migrate-androidx

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

androidx-select-backup

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

confirm-refactor-androidx

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 gradle.properties 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 Enable Multidex for Android App

Arithmetic Operations in Tensorflow