Error inflating class androidx.constraintlayout.ConstraintLayout after migration to androidx Error inflating class androidx.constraintlayout.ConstraintLayout after migration to androidx android android

Error inflating class androidx.constraintlayout.ConstraintLayout after migration to androidx


I solve my problem by changing all occurrences of

androidx.constraintlayout.ConstraintLayout

to

androidx.constraintlayout.widget.ConstraintLayout


Add androidx.constraintlayout.widget.ConstraintLayout to the dependencies:

dependencies  {    // https://mvnrepository.com/artifact/androidx.constraintlayout/constraintlayout    implementation "androidx.constraintlayout:constraintlayout:1.1.3"}

It's available on mavenCentral().


I had the same problem, I resolved it as follows:

In your dependecies if you have added

implementation 'androidx.constraintlayout:constraintlayout:1.x.x' that is correct

but in your xml layout file you have to use the widget as

androidx.constraintlayout.widget.ConstraintLayout