In this blog, we will learn how to migrate Android Project with AndroidX.
AndroidX is redesigned library to make package names more clear.
So from now Android hierarchy will be for only android default classes, which comes with android operating system.
Other library/dependencies will be part of AndroidX (Makes more sense). So from now all the new development will be updated in AndroidX.
Mapping of Old Package to New Package
When you migrate your current application with AndroidX, library/dependencies name will be changed.
com.android.support.** : androidx.
com.android.support:appcompat-v7 : androidx.appcompat:appcompat
com.android.support:recyclerview-v7 : androidx.recyclerview:recyclerview
com.android.support:design : com.google.android.material:material
android.arch.core:common : androidx.arch.core:core-common:2.0.0-rc01
You can check all the change packages name here -> AndroidX changed Packages Name
To know the history of AndroidX, you can also check Android Developer Blog Post -> AdnroidX Developer Post
How To Migrate Android Project
If you want to migrate already existing project, then simply follow these steps ->
Android Studio(Android Studio 3.2 and higher) -> Refactor -> Migrate To AndroidX
When you migrate your project, it will automatically change all the packages name.
OR
For new project, just put these lines in gradle.properties ->
1 2 |
android.enableJetifier=true android.useAndroidX=true |
And with this you complete your task to “Migrate Android Project with AndroidX”.
Note: Min SDK version should be 28.