I have bellow xml
:
You're using AndroidX
tags-components which you already have AppCompat
dependencies. This will cause other issues too. Go with the Refactor -> Migrate to AndoridX
and add the mentioned dependency for the material components too.
In your build.gradle
dependencies:
implementation 'com.google.android.material:material:1.0.0'
It's coming from Material components -> com.google.android.material
as you can see so, that's why you get the error.
Remember to update the gradle
in the other build.gradle
too:
classpath 'com.android.tools.build:gradle:3.2.0'
Don't forget to use Theme.MaterialComponents.Light.NoActionBar
(or any Theme.MaterialComponents.*.NoActionBar
really) as your parent AppTheme
in style.xml
(source).
Check your /res/values/styles.xml and set your theme to
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar" />
or similar
implementation 'com.google.android.material:material:1.0.0'
classpath 'com.android.tools.build:gradle:3.2.0'
If you have added the above two conditions and it's still showing the error you can try a "LinearLayout" instead.