Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) code example

Example 1: Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml

With Android Studio 3.2 and higher, you can migrate an existing project to AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
The refactor command makes use of two flags. By default, both of them are set to true in your gradle.properties file:
android.useAndroidX=true
The Android plugin uses the appropriate AndroidX library instead of a Support Library.
android.enableJetifier=true
The Android plugin automatically migrates existing third-party libraries to use AndroidX by rewriting their binaries.

Example 2: Manifest merger failed androidx

Inside app > build.gradle :
dependencies {
	...
    // add the following single line for androidx
    implementation 'androidx.appcompat:appcompat:1.1.0'
    // implementation before testImplementation
    testImplementation ......
}

Inside gradle.properties :
	android.useAndroidX=true
	android.enableJetifier=true
    
Inside AndroidManifest.xml :
	<application
    	....
        tools:replace="android:appComponentFactory"
        android:appComponentFactory="whateverString"
        ....
    >

Tags:

Misc Example