material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

SearchBar missing attribute error

Open AntoineMaille opened this issue 3 years ago • 1 comments

Hello, when using com.google.android.material.search.SearchBar.

I get this error :

java.lang.IllegalArgumentException: com.google.android.material.search.SearchBar requires a value for the projet.ludipass:attr/colorOnSurfaceVariant attribute to be set in your app theme. You can either set the attribute in your theme or update your theme to inherit from Theme.MaterialComponents (or a descendant)..

i use

implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'com.google.android.material:material:1.8.0-beta01'

and my theme extends Theme.Material3.Light.NoActionBar.

Thanks

AntoineMaille avatar Jan 03 '23 08:01 AntoineMaille

Actually i was extending Theme.MaterialComponents.DayNight.DarkActionBar in values-night (which i was not aware was blocking) which caused this error.

I switch it to Material3

AntoineMaille avatar Jan 03 '23 13:01 AntoineMaille