You are using material library which is part of AndroidX. If you are not aware of AndroidX, please go through this answer.
One app should use either AndroidX or old Android Support libraries. That's why you faced this issue.
For example -
In your gradle, you are using
com.android.support:appcompat-v7
(Part of old --Android Support Library--)com.google.android.material:material
(Part of AndroidX) (AndroidX build artifact of com.android.support:design
)So the solution is to use either AndroidX or old Support Library. I recommend to use AndroidX, because Android will not update support libraries after version 28.0.0. See release notes of Support Library.
Just migrate to AndroidX.Here is my detailed answer to migrate to AndroidX. I am putting here the needful steps from that answer.
Before you migrate, it is strongly recommended to backup your project.
Existing project
New project
Put these flags in your gradle.properties
android.enableJetifier=true
android.useAndroidX=true
Check @Library mappings for equal AndroidX package.
Check @Official page of Migrate to AndroidX