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


build.gradle => check dependencies version

implementation 'androidx.constraintlayout:constraintlayout:1.1.1'


to change

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

solved the problem


I has same issue after:

  • migration support library to androidx;
  • increment targetSdkVesrsion to 29;

I also use:

implementation "uk.co.chrisjenx:calligraphy:2.3.0"

I tried all posts from this question, but none success.

I fix it by adding one string .disableCustomViewInflation() to Calligraphy init:

@Override
public void onCreate() {

    super.onCreate();
    // ...
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/Sans-Regular.ttf")
            .setFontAttrId(R.attr.fontPath)
            .disableCustomViewInflation() // <----- this fix
            .build());
    // ...
}

I hope next release of Calligraphy (Christopher Jenkins thanks for your great job) will fix it inside too.