I was about to use a constraint-layout in my project when I noticed that there are two different dependencies that I can use:
com.android.support.constraint:constraint-layout
androidx.constraintlayout:constraintlayout
Is there a difference between these two or some recommendation on which is preferable?
EDIT
Google is stopping support for com.android.support
and prompts users to migrate to the new androidx
equivalent.
Note: With the release of Android 9.0 (API level 28) there is a new version of the support library called AndroidX which is part of Jetpack. The AndroidX library contains the existing support library and also includes the latest Jetpack components.
You can continue to use the support library. Historical artifacts (those versioned 27 and earlier, and packaged as android.support.*) will remain available on Google Maven. However, all new library development will occur in the AndroidX library.
We recommend using the AndroidX libraries in all new projects. You should also consider migrating existing projects to AndroidX as well.
Here is the official Migration guide and the corresponding library equivalents.
AndroidX is the open-source project that the Android team uses to develop, test, package, version and release libraries within Jetpack. AndroidX is a major improvement to the original Android Support Library.
Basically, AndroidX is a considerable enhancement to the original Android Support Library that is no longer maintained. AndroidX packages completely replace the Support Library by providing some new features and libraries. Artifacts within the androidx namespace comprise the Android Jetpack libraries.
Note: With the release of Android 9.0 (API level 28) there is a new version of the support library called AndroidX which is part of Jetpack. The AndroidX library contains the existing support library and also includes the latest Jetpack components. You can continue to use the support library.
So, if you want bug fixes or new features that would have previously gone into the Support Library, you need to migrate to AndroidX. Better package management. With AndroidX, you get standardized and independent versioning, as well as better standardized naming and more frequent releases.
AndroidX is a major improvement to the original Android Support Library, which is no longer maintained. androidx packages fully replace the Support Library by providing feature parity and new libraries. In addition, AndroidX includes the following features: All packages in AndroidX live in a consistent namespace starting with the string androidx.
Like the Support Library, libraries in the androidx namespace ship separately from the Android platform and provide backward compatibility across Android releases.
Note: With the release of Android 9.0 (API level 28) there is a new version of the support library called AndroidX which is part of Jetpack. The AndroidX library contains the existing support library and also includes the latest Jetpack components.
AndroidX Package Libraries (androidx.*) Introduced along with the release of Android Jetpack in 2018, AndroidX is a brand new way of organizing the support libraries. The older support libraries were somewhat confusing for the developers as one cannot say that which all classes are included in a particular library just by looking at its name.
All the support libraries are dropping the v4 v7 v12 v13 etc tags and everything is refactored into the androidx packages.
They are essentially the same but for future reference androidx will be the library that we should use in our apps.
Android studio 3.2 canary that comes out this week (week of May 14, 2018) should have the tool that allows automatic refactoring to the androidx packages. There was an announcement about this at google i/o 2018.
One of the difference between AndroidX and Support libraries is that when you use support libraries, all support libraries must be the same version, but in androidX there is no such thing.
other thing is that in support library, most of the time when you need a component in your app, you have to add dependencies that have so many other thing that you really don't need. but in AndroidX you can add only the dependency that you need and no more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With