Material-components-android: Manifest merger failed : Attribute application@appComponentFactory

Created on 4 Sep 2018  ยท  49Comments  ยท  Source: material-components/material-components-android

We're transitioning from github issues to a public buganizer component. Rather
than submitting a bug here on github, please file any bugs or feature requests
at https://issuetracker.google.com/issues/new?component=439535.

I bought a new macbook pro
i have installed all the latest stuff from android studio in my laptop from the stable channel

i am not able to successfully build my project gradle when i add
implementation 'com.google.android.material:material:1.0.0-rc01'

gradle
`apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.silverpants.todolist"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
`
errror it shows is

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

and when i take its suggestion an error appears like this
code
`
xmlns:tools="http://schemas.android.com/tools"
package="com.silverpants.todolist">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:replace="android:appComponentFactory"

    >
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

`

error

Manifest merger failed with multiple errors, see logs

and also

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugManifest'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:524)
at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:143)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 32 more

Most helpful comment

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.

All 49 comments

Duplicate of #103.

This is because you are using the new Material library with the legacy Support Library. You have to migrate android.support to androidx in order to use com.google.android.material.

Please take a look at our Getting Started Guide which talks about this.

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

i have this error i want to show a barchart

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.

I got a similar problem when using a new library,
I fixed the problem by migrating the project to androidx

The new android studio does the migration smoothly just click on Refactor-->migrate to androidx-->It will ask you to back up-->then do refactor.

Watch this tutorial, hope it helps.
https://www.youtube.com/watch?v=0FZ_eUIsLTg

@bukunmialuko One issue I am having is that if I try your method, it indicates you need to be on Gradle 3.2.0 or higher, but switching to that version causes this exception:
https://stackoverflow.com/a/52608833/2480714
Which does not seem to have a working solution other than downgrading gradle.

Update all your dependencies after migrating to androidx.

The error usually occurs whenever you use AndroidX with legacy support dependencies.
To solve it, just add the following line in your gradle.properties file:
android.enableJetifier=true
android.useAndroidX=true

still error exists

I am just extending the answer that
Add this implementation 'com.google.android.material:material:1.0.0' dependency and
Remove this dependency implementation 'com.android.support:appcompat-v7:28.0.0' from module level gradle file and its working for me.

I hope some one will get help.

As of Android P, the support libraries have been moved to AndroidX.

so remove com.android.support dependecies and move them to use android x namespace.

more details @ https://developer.android.com/jetpack/androidx/migrate

add these lines in the manifiest

tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"

The error usually occurs whenever you use AndroidX with legacy support dependencies.
To solve it, just add the following line in your gradle.properties file:
android.enableJetifier=true
android.useAndroidX=true

this one workeed

There might be any duplicate created.

On Sat, Mar 30, 2019 at 3:03 PM Jai Prakash sharma notifications@github.com
wrote:

The error usually occurs whenever you use AndroidX with legacy support
dependencies.
To solve it, just add the following line in your gradle.properties file:
android.enableJetifier=true
android.useAndroidX=true

this one workeed

โ€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/material-components/material-components-android/issues/193#issuecomment-478226320,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AdTcZNTOEhb8M7zEAsLqMXSGKJVD1QpJks5vby9TgaJpZM4WZXl4
.

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.

Can you please tell me where to add these two line in gradle?

They can be added anywhere in your gradle.properties file.

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.

Thanks a lot! Works for me!!!!!! Aleluia!!!!!!!!

We're transitioning from github issues to a public buganizer component. Rather
than submitting a bug here on github, please file any bugs or feature requests
at https://issuetracker.google.com/issues/new?component=439535.

I bought a new macbook pro
i have installed all the latest stuff from android studio in my laptop from the stable channel

i am not able to successfully build my project gradle when i add
implementation 'com.google.android.material:material:1.0.0-rc01'

gradle
`apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.silverpants.todolist"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
`
errror it shows is

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

and when i take its suggestion an error appears like this
code
`

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:replace="android:appComponentFactory"

    >
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

`

error

Manifest merger failed with multiple errors, see logs

and also

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugManifest'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:524)
at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:143)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 32 more

I had a similar problem.
solution for me was to change the version of react-native-device-info from 0.21.5 to 2.1.2.
after changing this I got this error.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:preDebugBuild'. Android dependency 'com.android.support:support-media-compat' has different version for the compile (27.0.2) and runtime (28.0.0) classpath. You should manually set the same version via DependencyResolution

And then added the following code in android/build.gradle in subprojects section

subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "26.1.0"
}
}
}
}

then it works for me

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.

It's Working thanks...

After use, all the above suggestions my Error still exists. can anyone help me, please?

Was having this issue in a ReactNative project - I used the "Migrate to AndroidX" option in Android Studio, and all it did was:

  1. Add
android.useAndroidX=true
android.enableJetifier=true

at the bottom of the file android/gradle.properties

  1. Replace the line
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    with
    implementation 'androidx.appcompat:appcompat:1.0.0'
    in android/app/build.gradle

Works great for me after this change

in my react-native app I solved it that way:

yarn upgrade --pattern react-native solved my issues
Refactoring to androidx only created cascades of issues
I had no androidx dependencies in build.gradle file, but had some inside node_modules.
I stayed up with "com.android.support:appcompat-v7:28.0.0"

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.

My app crashed after writing these two lines

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.

Add this two lines of code in Gradle.properties files

The error usually occurs whenever you use AndroidX with legacy support dependencies.
To solve it, just add the following line in your gradle.properties file:
android.enableJetifier=true
android.useAndroidX=true

worked! thanks.. Build is successful. Yet don't know if there is any runtime issues. I ll update if there is any.

if another error still exist, you can try this way :

  1. npm install --save-dev jetifier
  2. npx jetify

I just added
android.useAndroidX=true
android.enableJetifier=true
to gradle.properties and it resolved my issue.

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.

Saves my day <3

My app was working fine and then I installed react-native-push-notification library and now I'm getting this error as my Gradle files are not syncing.

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

My issue is not with Material and I tried every mentioned solution but still facing same error even when I remove the dependencies of that library.

My app was working fine and then I installed react-native-push-notification library and now I'm getting this error as my Gradle files are not syncing.

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

My issue is not with Material and I tried every mentioned solution but still facing same error even when I remove the dependencies of that library.

check this comment https://github.com/material-components/material-components-android/issues/193#issuecomment-450471987 or upgrade your react-native version https://github.com/material-components/material-components-android/issues/193#issuecomment-505422717

This gradle is the worst thing in Android, NEVER works fine; if you get your project and move from one computer to another, you have headache.

Then you have to do some sort of hack to get it to work... like adding these two properties. This thing really need improvement.

Hey need help ping me

On Thu, Sep 12, 2019 at 3:46 AM jairhumberto notifications@github.com
wrote:

Then you have to do some sort of hack to get it working... like add these
two properties

โ€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/material-components/material-components-android/issues/193?email_source=notifications&email_token=AHKNYZHRQ4SHW62OD27OTTDQJFU5VA5CNFSM4FTFPF4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6QCAHQ#issuecomment-530587678,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHKNYZFHTJNT7Y2ILZRIHQDQJFU5VANCNFSM4FTFPF4A
.

Those two properties need to be defined in a gradle.properties file at the root of your project, not in your build.gradle.

android.useAndroidX=true
android.enableJetifier=true

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.

I needed to also follow this:
https://github.com/facebook/react-native/issues/25483#issuecomment-520344889.

The combination of adding those lines to gradle.properties worked for me!

:(
Already I used Android Studio to migrate my project to AndroidX. It automatically adds the 2 lines in gradle.properties and replaces all android support libraries to the new AndroidX but I continue having the same issue.

Was having this issue in a ReactNative project - I used the "Migrate to AndroidX" option in Android Studio, and all it did was:

  1. Add
android.useAndroidX=true
android.enableJetifier=true

at the bottom of the file android/gradle.properties

  1. Replace the line
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    with
    implementation 'androidx.appcompat:appcompat:1.0.0'
    in android/app/build.gradle

Works great for me after this change

This solve my problem.. ๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘

The error usually occurs whenever you use AndroidX with legacy support dependencies.
To solve it, just add the following line in your gradle.properties file:
android.enableJetifier=true
android.useAndroidX=true

worked for me

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.

Works like a charm !

After adding
android.useAndroidX=true
android.enableJetifier=true
it solved and added androidx classes for all layouts
androidx.constraintlayout.widget.ConstraintLayout
androidx.drawerlayout.widget.DrawerLayout
Thank you @dsn5ft dsn5ft

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

not geetin the problem plzz help.

For anyone who isn't using Androidx and if you're using proguard, I see that adding this line in your proguard helped without adding anything to the manifest:

Proguard.flags https://android.googlesource.com/platform/packages/apps/Settings/+/master/proguard.flags#58

-keep class androidx.core.app.CoreComponentFactory

Was having this issue in a ReactNative project - I used the "Migrate to AndroidX" option in Android Studio, and all it did was:

  1. Add
android.useAndroidX=true
android.enableJetifier=true

at the bottom of the file android/gradle.properties

  1. Replace the line
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    with
    implementation 'androidx.appcompat:appcompat:1.0.0'
    in android/app/build.gradle

Works great for me after this change

thanks,it worked for me

Was having this issue in a ReactNative project - I used the "Migrate to AndroidX" option in Android Studio, and all it did was:

  1. Add
android.useAndroidX=true
android.enableJetifier=true

at the bottom of the file android/gradle.properties

  1. Replace the line
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    with
    implementation 'androidx.appcompat:appcompat:1.0.0'
    in android/app/build.gradle
    Works great for me after this change

thanks,it worked for me

I got the same error

Android Studio>Refactor>Migrate to AndroidX
Then Do Refactor.

This solves my problem.

build.gradle

Doing the refactor, works but you have to do it every single time.
The file below get overwritten each time.
android/capacitor-cordova-android-plugins/build.gradle
Replacing the androidx line with appcompat-v7

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.
yes and video tutorial about how to apply and where to apply
see this video
https://weblearners.blogspot.com/2020/08/how-to-solve-manifest-merger-failed.html

Just migrate and it's all done.

On Mon, 3 Aug, 2020, 9:47 PM smbiplob786, notifications@github.com wrote:

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.
yes and video tutorial about how to apply and where to apply
see this video

https://weblearners.blogspot.com/2020/08/how-to-solve-manifest-merger-failed.html

โ€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/material-components/material-components-android/issues/193#issuecomment-668111902,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AHKNYZELVJ7J3GJ7HVBPGCTR63PJ5ANCNFSM4FTFPF4A
.

Was this page helpful?
0 / 5 - 0 ratings