I had similar problem. Added two lines in gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
These two lines automatically resolved my dependency conflicts between google's files and third party dependencies. Here's the link to follow: https://developer.android.com/topic/libraries/support-library/androidx-overview#new-project
I faced same error when i try to add Kotlin-KTX library to my project.
I try to AndroidX migration, and problem fixed!
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
In my case, this is working perfectly.. I have added below two line codes inside manifest file
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"
Credit goes to this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With