Trying to add MSAL for android with android.support - android

I have a library that needs to do login via azure , when I try to implement msal to it I get 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.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:13:5-46:19 to override.
From my understanding (correct me if i'm wrong) it is caused because msal is using androidx and my main project is using android support ,
I can't migrate my project to androidx , any way to fix this issue ?
Many thanks!

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"

Google ad service ends the build with an error

I tried in the past to integrate Google AdMob in my application, and it worked. Now, when I try to rebuild the code, it ends up with an error I don't surely know what is it all about.
I wanted an implementation of a Banner Ad, but it ended up showing this in the build output section:
**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:10:5-34:19 to override.
**
You need to fully move to AndroidX.
The new Google AdMob libraries are all for AndroidX, not for support libraries prior 28.0.0.

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.

Android Manifest merger failed after sdk update?

this error randomly started happening today
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:6:5-20:19 to override.
so I did what is said to and now this happens
Manifest merger failed with multiple errors, see logs
what gives?
This error comes because the same attribute has a different value in different lib.
Add tools:replace="android:appComponentFactory in Application tag of AndroidManifest.xml
it will resolve this error.

Categories

Resources