MaterialCardView crashes with material:1.1.0 MaterialCardView crashes with material:1.1.0 android android

MaterialCardView crashes with material:1.1.0


you can just keep it in your materialcardview itself also:

 <com.google.android.material.card.MaterialCardView      android:layout_width="match_parent"      android:layout_height="wrap_content"      app:cardCornerRadius="8dp"     **** android:theme="@style/Theme.MaterialComponents.Light"  *****      app:cardElevation="8dp">


The error is in the stacktrace:

Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).

With the version 1.1.0 you have to inherit from a Theme.MaterialComponents.

Change your app theme to

<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">  <!-- ....  --></style>


You need to change your AppTheme to have it's parent theme as a descendant of MaterialComponent

In your particular case changing the AppTheme from

  <style name="AppTheme" parent="Theme.AppCompat.DayNight">

to

  <style name="AppTheme" parent="Theme.MaterialComponents.DayNight">

should fix the issue.