Error inflating class androidx.constraintlayout.widget.ConstraintLayout

Solution 1:

Make sure constraint layout is updated to latest version:

implementation 'androidx.constraintlayout:constraintlayout:2.1.3'

And replace your xml tag names

<androidx.constraintlayout.ConstraintLayout>

with

<androidx.constraintlayout.widget.ConstraintLayout>

in every place where it appears using this shortcut:

Windows: CTRL + SHIFT + R

Mac: COMMAND + SHIFT + R

Solution 2:

In AndroidStudio 3.3 RC2 I got it resolved by upgrading -

implementation 'androidx.constraintlayout:constraintlayout:1.1.2'

to

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

in build.gradle (Module: app)

Note: This solution is also valid for the release version 3.3 (as per below comment by FireZenk), 3.5.2 (as per below comment by user2350644)

Solution 3:

Just replace

<androidx.constraintlayout.ConstraintLayout>

with

<androidx.constraintlayout.widget.ConstraintLayout>

In your project's xml files.

You can use Replace in Path shortcut in mac (⇧⌘F or ⇧⌘R) and windows (Ctrl+Shift+R)

enter image description here