Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.

YouTube privacy policy

If you accept this notice, your choice will be saved and the page will refresh.


Show the video description

In this tutorial we will learn how to migrate an existing Android Studio project, to use the new AndroidX (Android Extension Libraries) dependencies.
The Android support libraries like appcompat-v7 and material design, as well as the Architecture Component libraries, have been refactored into the androidx namespace to provide simplified package names, more granular dependency artifacts and independent, semantic versioning.
This requires us to add different dependencies into our project level build.gradle file and use different import statements in our classes and XML layouts. For this, Android Studio 3.2 provides a “Migrate to AndroidX” assistant in the Refactor menu, that takes care of updating all these packages automatically.
However, before we can use this option we have to increase the version number of our Android gradle plugin in the project level build.gradle file to at least 3.2.0, update the gradle wrapper to version 4.6 with the “Fix Gradle wrapper and re-import project” quick fix and install the SDK for API level 28 (Android Pie) in the SDK Manager, because AndroidX requires at least compileSdkVersion 28.
Then we back up our Android Studio project, use the migrate feature, check everything in the Refactoring Preview and lastly click “Do Refactor” to migrate our Android Studio project to Androidx.
This will update all the package names throughout the project and add the useAndroidX and enableJetifier flags into the file. Jetifier takes care of translating dependencies of external libraries to the androidx packages if they haven’t been updated yet.

Mappings between old and new dependencies: