I'm a bit lost with google and android dev documentation, and I can't really pinpoint what's the key difference with android.support.constraint.ConstraintLayout and androidx.constraintlayout.widget.ConstraintLayout. Android Studio seems to give you the latter by default, but most texts on the subject seem to follow the former.
2 Answers
Basically, they represent the same thing. The main difference is that androidx.constraintlayout.widget.ConstraintLayout represents the AndroidX version.
What is AndroidX?
AndroidX is an open-source project which was recently released by the Android team and the purpose is to replace all the original support library APIs.
Invariably, androidx.constraintlayout.widget.ConstraintLayout is the newer/better version of android.support.constraint.ConstraintLayout and this should be your preference.
To learn about migrating your existing project to AndroidX, check this out.
I hope this helps. Merry coding!
Comments
So it's not only for ConstraintLayout!
- But
AndroidXis a major improvement to the original Android Support Library. - Like the Support Library, AndroidX ships separately from the Android OS and provides backwards-compatibility across Android releases.Here
- Design support library requires
andriodXmigration too! You should consider using androidX for your future projects! Here For design library to be used with
AndroidXversion add :
implementation 'com.google.android.material:material:version'Migrate your project to
androidXin Android Studio by going to:Refactor-> Migrate to AndroidXto migrate your project and there you can backup your project if some problem occurs migrating project.After that your dependendencies will have androidX packages automatically.
androidxis just the newest version.