Android-image-cropper: Mainfest merger failed

Created on 27 Oct 2018  路  31Comments  路  Source: ArthurHub/Android-Image-Cropper

Tried to include the library but got this 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 AndroidManifest.xml:9:5-29:19 to override.
So, I added the tools:replace="android:appComponentFactory" to manifest and since then I'm getting
````
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugManifest'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
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:256)
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:249)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
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:663)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
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:540)
at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:173)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
at sun.reflect.GeneratedMethodAccessor814.invoke(Unknown Source)
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:50)
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:124)
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:113)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
... 33 more

````

Most helpful comment

use 2.7.0 instead, which helps

All 31 comments

I just ran into this issue as well. When you open the Merged Manifest view of AndroidManifest.xml, do you see an error complaining that tools:replace has no value specified in app main (or something along those lines)?

That's the erorr I saw, and I added another property to the application element to specify the appComponentFactory to use (still not sure if this is the right one)

android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
tools:replace="android:appComponentFactory"

The tools:replace property is used to override properties that conflict when merging manifests. So I think it also requires a value to be set. See the docs for more information.
https://developer.android.com/studio/build/manifest-merge

I am having the same problem.
I am currently using the Pixel 2XL with android Pie.
It is crashing with the previous version 2.7, and with the new one 2.8 I am having this problem with Manifest Merged Fail.
If I try to put tools:replace="android:appComponentFactory", however the Kotlin extensions stops to be recognised and other errors happens.

Some gradle informations:

compileSdkVersion 28
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'

i also this issue, any solution ?

I have same issue

i also have the same issue, this is a good library, hope the author can solve it

any update and solution ?

I have the same problem

Any solution ???

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:44:5-610:19 to override

How can solve this issue , this is a good library.
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'

For me the Manifest merger fails when I add in build.gradle the dependency
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
together with at least one of these dependencies:
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
and apply _Sync Now_...

Please help!

use 2.7.0 instead, which helps

I just ran into this issue as well. When you open the Merged Manifest view of AndroidManifest.xml, do you see an error complaining that tools:replace has no value specified in app main (or something along those lines)?

That's the erorr I saw, and I added another property to the application element to specify the appComponentFactory to use (still not sure if this is the right one)

android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
tools:replace="android:appComponentFactory"

The tools:replace property is used to override properties that conflict when merging manifests. So I think it also requires a value to be set. See the docs for more information.
https://developer.android.com/studio/build/manifest-merge

I get packaging error with androidx components on adding this in manifest

use 2.7.0 instead, which helps

For the moment this is a working solution.
Just ignoring the warning about dependencies in build.gradle:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.1. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:exifinterface:27.1.1...

i have same issue.

same issue here

Same issue here...

2.7.0 works fine... But...

Same issue here :/

Same here..

2.7.0 works fine... But...

but...could you enlighten me enlighten me what are the differences between 2.7 & 2.8?

@ffischer1984

Update to support library to AndroidX

So if you need use version 2.8 when you need update your project to Android X
https://developer.android.com/jetpack/androidx/migrate

for me 2.7 worked

migrated to AndroidX, version 2.8 will work.

Using 2.7 worked for me. It seems 2.8 is built for Android X Projects

Please remove the AndroidX support! Many of us can't upgrade our massive projects to AndroidX yet, making it impossible to use 2.8.0 of this library. 2.7.0 has a major bug that causes Android Pie devices to crash when cropping which was fixed in 2.8.0, so right now your library is effectively broken for anyone who can't update to AndroidX yet.

2.7.0 works fine... But...

but...could you enlighten me enlighten me what are the differences between 2.7 & 2.8?

Version 2.7 doesn't work on devices running Android 9 (Pie)

For anyone interested I build a non AndroidX version.

I added it to to this comment as a .aar file.
To include it into your project place the .aar file into <project>/app/libs folder.

Then to implement it into your build.gradle:
For your <project>/app/build.gradle add this to your dependencies
implementation(name: 'android-image-cropper-2.8.0-nonX', ext: 'aar') { transitive = true }

For your <project>/build.gradle add this to your allprojects > repositories (I added it at the bottom)
flatDir{ dirs 'libs' }

android-image-cropper-2.8.0-nonX.zip

For All Those getting Merging Error
use 2.5.0 version that is
implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.0'
it will work now .I guess some error with new version compatibility

In my case, I solved the problem by modifying build.gradle(Modules) as follows.

implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:design:26.0.2'

implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.0'

ps. I was angry for about two days, but fortunately I was working normally.

2.7.0 works fine...

Today 23/04/2019 Work for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rahulwadhai picture rahulwadhai  路  5Comments

Transformat picture Transformat  路  5Comments

Ani24may picture Ani24may  路  5Comments

danponce picture danponce  路  3Comments

jjimenez0611 picture jjimenez0611  路  4Comments