Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest merger failed : Attribute application@appComponentFactory #193

Closed
jeevansurendran opened this issue Sep 4, 2018 · 42 comments
Closed

Comments

@jeevansurendran
Copy link

@jeevansurendran jeevansurendran commented Sep 4, 2018

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 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

@dsn5ft

This comment has been minimized.

Copy link
Contributor

@dsn5ft dsn5ft commented Sep 4, 2018

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.

@dsn5ft dsn5ft closed this Sep 4, 2018
@sammrabatool

This comment has been minimized.

Copy link

@sammrabatool sammrabatool commented Nov 14, 2018

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.

@sammrabatool

This comment has been minimized.

Copy link

@sammrabatool sammrabatool commented Nov 14, 2018

i have this error i want to show a barchart

@blessingofallah

This comment has been minimized.

Copy link

@blessingofallah blessingofallah commented Dec 29, 2018

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.

@bukunmialuko

This comment has been minimized.

Copy link

@bukunmialuko bukunmialuko commented Jan 3, 2019

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

@PGMacDesign

This comment has been minimized.

Copy link

@PGMacDesign PGMacDesign commented Jan 14, 2019

@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.

@bukunmialuko

This comment has been minimized.

Copy link

@bukunmialuko bukunmialuko commented Jan 14, 2019

Update all your dependencies after migrating to androidx.

@imohchard

This comment has been minimized.

Copy link

@imohchard imohchard commented Jan 19, 2019

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

@sandeepmaxpayne

This comment has been minimized.

Copy link

@sandeepmaxpayne sandeepmaxpayne commented Feb 25, 2019

still error exists

@IDFDeveloper

This comment has been minimized.

Copy link

@IDFDeveloper IDFDeveloper commented Mar 15, 2019

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.

@Harishn28

This comment has been minimized.

Copy link

@Harishn28 Harishn28 commented Mar 17, 2019

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

@androidqasim

This comment has been minimized.

Copy link

@androidqasim androidqasim commented Mar 26, 2019

add these lines in the manifiest

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

@iamjpsharma

This comment has been minimized.

Copy link

@iamjpsharma iamjpsharma commented Mar 30, 2019

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

@sandeepmaxpayne

This comment has been minimized.

Copy link

@sandeepmaxpayne sandeepmaxpayne commented Apr 1, 2019

@gaurav2010ec

This comment has been minimized.

Copy link

@gaurav2010ec gaurav2010ec commented Apr 26, 2019

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?

@dsn5ft

This comment has been minimized.

Copy link
Contributor

@dsn5ft dsn5ft commented Apr 26, 2019

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

@robleds

This comment has been minimized.

Copy link

@robleds robleds commented Jun 18, 2019

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!!!!!!!!

@irfanshaikh138

This comment was marked as outdated.

Copy link

@irfanshaikh138 irfanshaikh138 commented Jun 20, 2019

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

@Gnkumararaja

This comment has been minimized.

Copy link

@Gnkumararaja Gnkumararaja commented Jun 20, 2019

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...

@abdussamad123

This comment has been minimized.

Copy link

@abdussamad123 abdussamad123 commented Jun 21, 2019

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

@ziarno

This comment has been minimized.

Copy link

@ziarno ziarno commented Jun 21, 2019

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
2. 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

@nikopolidi

This comment has been minimized.

Copy link

@nikopolidi nikopolidi commented Jun 25, 2019

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"

@madgreasemonkey

This comment has been minimized.

Copy link

@madgreasemonkey madgreasemonkey commented Jul 25, 2019

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

@redreceipt redreceipt mentioned this issue Aug 2, 2019
5 of 14 tasks complete
@send2abhishek

This comment has been minimized.

Copy link

@send2abhishek send2abhishek commented Aug 4, 2019

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

@buddhiv

This comment has been minimized.

Copy link

@buddhiv buddhiv commented Aug 6, 2019

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.

@barakucrut

This comment has been minimized.

Copy link

@barakucrut barakucrut commented Aug 6, 2019

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

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

This comment has been minimized.

Copy link

@bhogteyash99 bhogteyash99 commented Aug 14, 2019

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

@AliYar-Khan

This comment has been minimized.

Copy link

@AliYar-Khan AliYar-Khan commented Aug 19, 2019

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

@aunabbas007

This comment has been minimized.

Copy link

@aunabbas007 aunabbas007 commented Aug 28, 2019

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.

@AliYar-Khan

This comment has been minimized.

Copy link

@AliYar-Khan AliYar-Khan commented Aug 28, 2019

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 #193 (comment) or upgrade your react-native version #193 (comment)

@jairhumberto

This comment has been minimized.

Copy link

@jairhumberto jairhumberto commented Sep 11, 2019

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.

@jairhumberto

This comment has been minimized.

Copy link

@jairhumberto jairhumberto commented Sep 11, 2019

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

@sandeepmaxpayne

This comment has been minimized.

Copy link

@sandeepmaxpayne sandeepmaxpayne commented Sep 12, 2019

@pouriaHemmati

This comment has been minimized.

Copy link

@pouriaHemmati pouriaHemmati commented Sep 15, 2019

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

@milesmeow

This comment has been minimized.

Copy link

@milesmeow milesmeow commented Oct 6, 2019

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:
facebook/react-native#25483 (comment).

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

@neoacevedo

This comment has been minimized.

Copy link

@neoacevedo neoacevedo commented Oct 10, 2019

:(
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.

@kpamar06

This comment has been minimized.

Copy link

@kpamar06 kpamar06 commented Dec 2, 2019

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
2. 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.. 👍👍👍👍👍👍👍

@androidcode33

This comment has been minimized.

Copy link

@androidcode33 androidcode33 commented Dec 5, 2019

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

@abd0ibrahim

This comment has been minimized.

Copy link

@abd0ibrahim abd0ibrahim commented Dec 19, 2019

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 !

@sandeepa91

This comment has been minimized.

Copy link

@sandeepa91 sandeepa91 commented Dec 20, 2019

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

@suraj8141066949

This comment has been minimized.

Copy link

@suraj8141066949 suraj8141066949 commented Dec 29, 2019

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.

@hyunjkim

This comment has been minimized.

Copy link

@hyunjkim hyunjkim commented Jan 16, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.