Home » Android » java – IllegalArgumentException When trying to use @style/Widget.MaterialComponents.TextInputLayout.OutlinedBox-Exceptionshub

java – IllegalArgumentException When trying to use @style/Widget.MaterialComponents.TextInputLayout.OutlinedBox-Exceptionshub

Posted by: admin February 26, 2020 Leave a comment

Questions:

I am trying to stylize the TextInputLayout with an outline. But when I try to use @style/Widget.MaterialComponents.TextInputLayout.OutlinedBox in style attribute my app crashes with this exception:

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

Here is the TextInputLayout theme I want to use OutlinedBox

It was working fine but suddenly this error appeared during development

<style name="LoginTextInputLayoutStyle" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
    <item name="boxStrokeColor">@color/text_input_box_stroke</item>

</style>
How to&Answers: