Home » Android » Android Errors and Solutions » Error inflating class androidx.constraintlayout.ConstraintLayout

Error inflating class androidx.constraintlayout.ConstraintLayout

Recently when we migrated one of our android application to AndroidX, using android studio’s option from “Refactor -> Migrate to AndroidX” , it was expected that everything should work fine but during compilation it failed with following error,

AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class androidx.constraintlayout.ConstraintLayout
AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.constraintlayout.ConstraintLayout" on path

Solution

This error has came because android was not able to find “androidx.constraintlayout.ConstraintLayout” class after migrating to androidX, since android uses “androidx.constraintlayout.widget.ConstraintLayout” class in androidX

hence search for all occurrences of “android.support.constraint.ConstraintLayout” and change those to “androidx.constraintlayout.widget.ConstraintLayout


Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment