Overview of AndroidX & How to Develop Project With AndroidX?
Mobile app developmentAndroidX
Google is rolling out a new package structure for Android development which is named as AndroidX.
Why introduced AndroidX, what would happen to existing Android?
We now that currently, android latest API for development is Oreo which is API level 27, now android is moving one step forward to a new operating system whose version would be API level 28.
The existing Android.* package hierarchy will be reserved for Android packages that are shipped with the operating system, means the existing android packages would only be used for Android OS own app such as camera app, message app, callapp etc.
Other packages will be issued in the new androidx.*package hierarchy, means the other new third-party application for API level 28 would be suggested to be developed with android.* package name.
Do you need to forcefully update to AndroidX?
No, the android.* packages will remain available on Google Maven for those apps versioned 27 and earlier.
How would I know what is the different-different packages version is for? What does it indicates?
Mainly there are three kinds of versioning semantics
- MAJOR (e.g. 1.0.0 to 2.0.0) indicates that there is major API changes, so you need to check app after doing major updates.
- MINOR (e.g. 1.0.0 to 1.0.1) indicates that this is some additions in some functionality in terms of backward-compatible management.
- PATCH (e.g. 1.0.0-beta1 to 1.0.0-beta2) indicates that there is an improvement for backward-compatible and bug fixes to previous.
How to develop project with AndroidX?
Following are the things you need to take care when developing android application with AndroidX
Firstly, your new project needs to target API level 28 from build.gradlefile, because target API level 28 is necessary for AndroidX.
Secondly, you need to add following lines in your gradle.properties file
android.useAndroidX=true
android.enableJetifier=true
this would enable AndroidX support to your project.
Some of the examples of AndroidX packages:
Android | AndroidX |
com.android.support:cardview-v7 | androidx.cardview:cardview:1.0.0-alpha1 |
com.android.support:design | com.google.android.material:material:1.0.0-alpha1 |
com.android.support:recyclerview-v7 | androidx.recyclerview:recyclerview:1.0.0-alpha1 |
com.android.support:support-v13 | androidx.legacy:legacy-support-v13:1.0.0-alpha1 |
com.android.support:support-compat | androidx.core:core:1.0.0-alpha1 |
com.android.support:multidex | androidx.multidex:multidex:2.0.0 |
com.android.support:appcompat-v7 | androidx.appcompat:appcompat:1.0.0-alpha1 |
Whats is the latest version of AndroidX to use?
The first version of AndroidX was 1.0.0 alpha1 which were released on May 8, 2018
Currently, the latest version of AndroidX is 1.0.0-beta01 which is released on July 2, 2018