material-components-android: Manifest merger failed : Attribute application@appComponentFactory
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🏃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 <application> element at AndroidManifest.xml:5:5-19:19 to override.
and when i take its suggestion an error appears like this code `<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" 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>
</manifest>`
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
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 18
- Comments: 51 (2 by maintainers)
Commits related to this issue
- Update a lot of shit (also migrated to AndroidX, whatever that is 😅) See - https://github.com/material-components/material-components-android/issues/193#issuecomment-418463394 - https://github.com/m... — committed to henrik242/revertalicious by henrik242 5 years ago
- Update a lot of shit (also migrated to AndroidX, whatever that is 😅) See - https://github.com/material-components/material-components-android/issues/193#issuecomment-418463394 - https://github.com/m... — committed to henrik242/revertalicious by henrik242 3 years ago
- Update a lot of shit (also migrated to AndroidX, whatever that is 😅) See - https://github.com/material-components/material-components-android/issues/193#issuecomment-418463394 - https://github.com/m... — committed to henrik242/revertalicious by henrik242 5 years ago
- Update a lot of shit (also migrated to AndroidX, whatever that is 😅) See - https://github.com/material-components/material-components-android/issues/193#issuecomment-418463394 - https://github.com/m... — committed to henrik242/revertalicious by henrik242 5 years ago
- Merge pull request #193 from android/update/recycler_viewe Updating RecyclerViewKotlin sample — committed to mohand1993/material-components-android by MagicalMeghan 4 years ago
I had similar problem. Added two lines in gradle.properties file:
android.useAndroidX=trueandroid.enableJetifier=trueThese 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
add these lines in the manifiest
tools:replace=“android:appComponentFactory” android:appComponentFactory=“whateverString”
Duplicate of #103.
This is because you are using the new Material library with the legacy Support Library. You have to migrate
android.supportto androidx in order to usecom.google.android.material.Please take a look at our Getting Started Guide which talks about this.
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
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 AndroidManifest.xml:5:5-19:19 to override.
I am just extending the answer that Add this
implementation 'com.google.android.material:material:1.0.0'dependency and Remove this dependencyimplementation '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.
Update all your dependencies after migrating to androidx.
Can you please tell me where to add these two line in gradle?
Was having this issue in a ReactNative project - I used the “Migrate to AndroidX” option in Android Studio, and all it did was:
at the bottom of the file
android/gradle.properties2. Replace the lineimplementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"withimplementation 'androidx.appcompat:appcompat:1.0.0'inandroid/app/build.gradleWorks great for me after this change
After use, all the above suggestions my Error still exists. can anyone help me, please?
in my react-native app I solved it that way:
yarn upgrade --pattern react-nativesolved my issues Refactoring to androidx only created cascades of issues I had noandroidxdependencies in build.gradle file, but had some inside node_modules. I stayed up with “com.android.support:appcompat-v7:28.0.0”Thanks a lot! Works for me!!! Aleluia!!!
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!
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.
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
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.
My app crashed after writing these two lines
i have this error i want to show a barchart
worked for me
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 just added android.useAndroidX=true android.enableJetifier=true to gradle.properties and it resolved my issue.
if another error still exist, you can try this way :
this one workeed
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