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.

1
  • They're the same component, androidx is just the newest version. Commented Aug 18, 2019 at 16:12

2 Answers 2

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!

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.