1

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.

Sumit Shukla
  • 4,116
  • 5
  • 38
  • 57
juztcode
  • 1,196
  • 2
  • 21
  • 46

2 Answers2

1

So it's not only for ConstraintLayout!

  • But AndroidX is 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 andriodX migration too! You should consider using androidX for your future projects!
  • Here For design library to be used with AndroidX version add :
    implementation 'com.google.android.material:material:version'

  • Migrate your project to androidX in Android Studio by going to: Refactor-> Migrate to AndroidX to 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.

Sumit Shukla
  • 4,116
  • 5
  • 38
  • 57
1

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!

Taslim Oseni
  • 6,086
  • 10
  • 44
  • 69