Android Material and appcompat Manifest merger failed Android Material and appcompat Manifest merger failed android android

Android Material and appcompat Manifest merger failed


I had similar problem. Added two lines in gradle.properties file:

android.useAndroidX=trueandroid.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!

Refactor/Migrate to AndroidX


Reason of Fail

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)

Solution

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

  • Android Studio > Refactor Menu > Migrate to AndroidX...
  • It will analysis and will open Refractor window in bottom. Accept changes to be done.

image

New project

Put these flags in your gradle.properties

android.enableJetifier=trueandroid.useAndroidX=true

Check @Library mappings for equal AndroidX package.

Check @Official page of Migrate to AndroidX

What is Jetifier?