Migrate to AndroidX — Jetpack Lib

What is AndroidX?

It’s a new library improved from the Android support libraries that will be used to develop within the jetpack. Android X replaces the support libs by delivering equally and new libraries. Moreover, this includes the below features:

  • All support libraries are separately maintained and updated

Android Jetpack

Android Jetpack is a new set of libraries, tools and architecture guidance designed to help the developer to increase an android development with high-quality apps. Jetpack is used to write an android code with the production-ready template. There are four components: Architecture, Foundation, Ui and Behaviour. These components will help you to follow the best practices, and provide a boilerplate code (Very big hectic for me to start a new app). This means you can adapt each commonest at your own speed and time. The unbundled Jetpack libraries have all been moved into the new androidx.* namespace.

Android Jetpack structure

From the above pictures, We have some new libraries:

  • Navigation stable release

How AndroidX related to Jetpack ..?

Jetpack is a set of libraries, which provide tools and recommendation to create a high-quality app. On the other hand, AndroidX is a library itself, whose feature might be in Android Jetpack. Like Android KTX and slices belongs to AndroidX and Jetpack also.

Migrate to AndroidX


  • Backup the whole project manually. Although android studio gives you the option to backup before migrating its helpful to have one more backup for incase.

Now grab a coffee this may take a while 😅

Now grab a coffee

In Android Studio check the menu Refactor>Migrate to AndroidX. If you check this, you may face the following error if your project Gradle is not on latest one:

Error in AndroidX migration

How to solve this :

  • Compile Sdk version on 28



Sync the project and Fix Gradle wrapper and re-import project. If you face Gradle wrapper error.

Now we are good to go to Migrate to AndoridX. Hit again to Migrate to Android from Refactor Options and do refactor like this

Prompt to refactor the project for AndroidX

Compile app

After fixing all error, maybe on runtime for some library give an error like a butterknife, room. You should compile the app and run all test by going through every screen to make sure that everything works perfectly after this big migration.


Here we are at the end of Android X migration and our app is working fine. Here are some tips to make sure migration will be executed perfectly:

  • Backup the project (very important)

Good luck, If you find this blog helpful do clap for me 👏

Android Developer, Freelance, Enthusiastic Learner

Android Developer, Freelance, Enthusiastic Learner