Error inflating class android.support.v7.widget.CardView

Just locate your cardview layout in your xml file, for example

<android.support.v7.widget.CardView......</android.support.v7.widget.CardView>

and replace it with

<androidx.cardview.widget.CardView.......</androidx.cardview.widget.CardView>

I solved this by adding updated cardview and appcompat on the app/build.gradle

dependencies {
    ...
    compile 'com.android.support:appcompat-v7:23.4.0'    
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    }

Then rebuild the project


the issue can also be caused by using the androidX try to change to <androidx.cardview.widget.CardView and the crashing should be ok. One tip, check if you see the layout in the preview.

in the gradle it shoud be like : implementation 'androidx.cardview:cardview:1.0.0'