java.lang.IllegalArgumentException: This component requires that you specify a valid android:textAppearance attribute

Roland Szép picture Roland Szép · Jun 12, 2018 · Viewed 41.1k times · Source

I have a com.google.android.material.button.MaterialButton component in one of my layout file and I get this error when I am using the latest version of the Material Components library (com.google.android.material:material:1.0.0-alpha3):

java.lang.IllegalArgumentException: This component requires that you specify a valid android:textAppearance attribute.

It wasn't present in 1.0.0-alpha1. Is this a bug in the library or should I just specify a textAppearance attribute from now?

Answer

Cameron Ketcham picture Cameron Ketcham · Jun 12, 2018

Does your theme extend from Theme.MaterialComponents? More info about how to ensure all the components will work correctly can be found at https://material.io/develop/android/docs/getting-started/