ERROR: Manifest merger failed : Attribute application#appComponentFactory in android [duplicate] - android

This question already has answers here:
Manifest merger failed : Attribute application#appComponentFactory - Androidx
(14 answers)
Closed 2 years ago.
I'm not able to use android.support.v7.app.AppCompatActivity. It shows error on import android.support.v7.app.AppCompatActivity; as follows: Cannot resolve symbol 'v7'. I have even added implementation 'com.android.support:appcompat-v7:28.0.0' in the build.gradle.
After setting android.useAndroidX=true and android.enableJetifier to false in the gradle.properties, the above mentioned error resolves but instead, I'm getting an error as follows: 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.5.0-alpha02] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:5:5-20:19 to override. Even after adding tools:replace="android:appComponentFactory to AndroidManifest.xml, I'm getting the same error.
I'm using compileSdkVersion 28 and targetSdkVersion 28.

This is primarily happening because you are using Androidx with the v28 support library , you can remove the v28 library if you are using the androidx library , if you are using the v28 support library do otherwise.
androidx.core:core:1.5.0-alpha02
Well the error says that because androidx core and v28 are conflicting. Use either one. And androidx core also has the same methods as the v7.AppCompatActivity has , so why don't you migrate it to androidx using
import androidx.appcompat.app.AppCompatActivity

Related

Merging Errors: Error: Attribute application#appComponentFactory in android 28.0.3

Merging Errors: Error: Attribute application#appComponentFactory value=(androidx.core.app.CoreComponentFactory) from AndroidManifest.xml:22:18-86 is also present at AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:39:5-738:19 to override.
in android 28.0.3 i want solution without migrating androidx. thanks in advance.
As it's suggested why you don't add
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
tools:replace="android:appComponentFactory"
to mainfest application tag.and if you want to use suport library rather than androidx please don't try to use libraries that use androidx.

Dagger and Butterknife

I am using dagger2 in my app. But when I started project my activities was extended support AppcompatActivity.Now while build I am getting warning via butterknife.
API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
To fix this I must upgrade butterknife version from 9.0.0-rc1 to 10.2.0 when I change version butterknife to 10.2.0 I am getting error to build.Because I am not using androidx. error like 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:9:5-70:19 to override.
So I don't know how to fix this issue.If somebody had such kind of error and warning please help me if you fixed it
Migrate your project to AndroidX, butterknife 10.2.0 is on androidX.
It literally says what you need to do. Add tools:replace="android:appComponentFactory" like this: <application tools:replace="android:appComponentFactory"

How to find which library use AndroidX - [Resolved]

I'm using react native and my Android project isn't compiling anymore because of 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:28:5-109:19 to override.
I've tried to add that tag but I'm getting always errors!!
I've tried to remove all packages to find which had androidX support or how to fix this bug, but I've been stuck for days!
Thanks!
UPDATE
I've opened all gradle files of the libraries and one at the time I've checked the dependencies, excluding or changing the version of some.
A terrible work but now I'm able to compile...
Thanks to all!
This is probably related to a Google update on the google place services. You can find which library is using AndroidX with this command:
gradlew app:dependencies
App is the name of your module/project but that is usually the default one.
If you can't solve this this way, post your project and app build.gradle
Make sure that you import the right version for AndroidX from here: https://developer.android.com/jetpack/androidx/migrate
I got stuck one day also just because integrate wrong version. So check it just to be sure.

Manifest merger failed when using leakcanary 2.0 alpha 2

I am using leakcanary 1.6.3 in my project to find memory-leaks without any problem using:
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
Now I want to update it to leakcanary 2.0 alpha 2 using:
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-2
But when I try to build project, it gives me manifest merger failed.
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.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:10:5-50:19 to override.
How do I fix this error?
Update: I am using android.support libraries in my project.
After some research in leakcanary 2.0 alpha 2 code, I found that the new version of library uses androidx libraries but I am using android.support libraries in my project. If I refactor my project to use androidx then no error occur.
It seems that:
A project using androidx can use a library that uses android.support
But a project using android.support can not use a library that uses androidx
This SO answer explain androidx and how to migrate your project to androidx.

Manifest merger failed how to solve? [duplicate]

This question already has an answer here:
Manifest Merger Error - Different versions of support library
(1 answer)
Closed 4 years ago.
After adding new library app showing error?
I am trying to add
compile 'com.github.badoualy:stepper-indicator:1.0.7'
and after added this my app showing error
Error:Execution failed for task ':sample:processShopifyDebugManifest'.
Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from
[com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31 is
also present at [com.android.support:appcompat-v7:26.0.0-beta2]
AndroidManifest.xml:28:13-41 value=(26.0.0-beta2). Suggestion: add
'tools:replace="android:value"' to element at
AndroidManifest.xml:23:9-25:38 to override.
May be this is right way to solve this issue
https://stackoverflow.com/a/45258773/10010192
Probably you are using multiple versions of Android support library. So Please choose one of version and use it for all libraries. Maybe you can try 25.4.0 for all. (You also need to change compileSdkVersion and targetSdkVersion to 25.4.0)
don't use 'compile' in build.gradle.
try to change
compile 'com.github.badoualy:stepper-indicator:1.0.7'
to
implementation 'com.github.badoualy:stepper-indicator:1.0.7'

Categories

Resources