material-components / material-components-android

Modular and customizable Material Design UI components for Android
Apache License 2.0
16.32k stars 3.06k forks source link

textfield.TextInputLayout App crashing with Caused by: java.lang.IllegalArgumentException: This component requires that you specify a valid TextAppearance attribute. Update your app theme to inherit from Theme.MaterialComponents (or a descendant). #3871

Open yogeshmehare opened 10 months ago

yogeshmehare commented 10 months ago

device is google emulator api 33 and using same material component theme for activity as well as app. I tried by adding android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" this line of code but same isseue is repeating please check.

Code is : <com.google.android.material.textfield.TextInputLayout android:id="@+id/menu" style="@style/Widget.Material3.TextInputLayout.FilledBox.ExposedDropdownMenu" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" android:hint="@string/label">

    <AutoCompleteTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="none"
        app:simpleItems="@array/simple_items"
        android:hint="@string/label"
        android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
        />

</com.google.android.material.textfield.TextInputLayout>
afohrman commented 10 months ago

Looks like this is hitting this IllegalArgumentException: https://github.com/material-components/material-components-android/blob/dfa474fdc76b37af45096f617c854c000b21cb2c/lib/java/com/google/android/material/internal/ThemeEnforcement.java#L187 which is generally caused by theming issues.

Could you please upload a sample project so that we can try to pinpoint the source of the issue?