Android Manifest Merger fails after adding Dependency com.google.android.material

Don't forget to add

android.useAndroidX=true
android.enableJetifier=true

to your gradle.properties. I always forget this when I get on a new machine because gradle.properties is not in source control. Would be great if we got a sensible error in this case.


Main problem here is that you are adding

com.google.android.material:material:1.0.0-beta01

that belongs to newly released androidx package and nowadays it is not compatible with android support library that you have in your dependencies.

You have 2 options:

  1. Replace com.google.android.material:material:1.0.0-beta01 with com.android.support:design:28.0.0-beta01 (see all support libraries https://developer.android.com/topic/libraries/support-library/packages) (that I recommend)
  2. Use Android Studio option Refactor to AndroidX (see https://material.io/develop/android/docs/getting-started/) (I do not recommend)

Here is sample of working code:

 <android.support.design.widget.TextInputLayout
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        app:boxStrokeColor="@color/colorAccent"
        app:boxStrokeWidth="5dp">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/messageEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

 </android.support.design.widget.TextInputLayout>

I have this problem too. When use this library in dependencies

implementation 'com.google.android.material:material:1.0.0'

Give this :

Manifest merger failed : Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:5:5-40:19 to override.

I have this problem by switching to AndroidX

Going to Refactor->Migrate to AndoridX (in toolbar of android studio 3.2 and above)

And my problem solve

refrence