Working on a React Native project but out of sudden it stopped working & started giving an 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:7:5-117 to override.
I know Google has done with Support Library class after 28 and I know How to migrate whole project from Support Library class to AndroidX class.
My question is:
Is there any possible way to keep using Support Library class rather than shifting to AndroidX class?
How to fix this issue?
AndroidX is a major improvement to the original Android Support Library, which is no longer maintained. androidx packages fully replace the Support Library by providing feature parity and new libraries.
Why you should migrate your app to AndroidX? Unlike the Support Library, AndroidX packages are separately maintained and updated. The androidx packages use strict Semantic Versioning . So you can update AndroidX libraries in your project independently.
We recommend using the AndroidX libraries in all new projects. You should also consider migrating existing projects to AndroidX as well. So all Android apps should now aim to use AndroidX, instead of the old support library.
You can lock down your googleservices and firebase versions to avoid androidX.
In android/build.gradle add:
buildscript {
...
ext {
// Lock down googlePlayServicesVersion
googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.6.0"
}
}
OR in gradle.properties add:
googlePlayServicesVersion=16.1.0
firebaseVersion=17.6.0
Probably post your app level gradle file here. Ideally if you are using some other dependency which is the updated/latest one then you would get this error.
If any of the dependency is the latest/updated one please downgrade it to the lesser version from checking the change logs from it's github. For me the culprit was stripe version which was internally using the androidx and was getting this error. i downgraded it and boom! It's gone :)
And also disable the androidx from gradle.properties
file using
android.useAndroidX=false
android.enableJetifier=false
Which forces the androidx to be disabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With