0
votes

I am working on a App using Firebase. I got a issue which needs to get solved. When i go to run the app it shows in build.

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-31:19 to override.

I searched the whole internet to solve the issue failed. I also added

tools:replace="android:appComponentFactory"

in the AndroidManifest.xml file. I also followed the answer of This Question. but it didn't work for me saying

Manifest merger failed with multiple errors, see logs

How can i solve this problem. What should i do now.

build.grable

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.offtechitbd.e_orderapp"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:28.0.0'

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    implementation 'com.firebaseui:firebase-ui-database:3.2.2'

    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'io.paperdb:paperdb:2.6'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'

}
apply plugin: 'com.google.gms.google-services'
3
when question is related to manifest file, why have you posted gradle file instead of manifest ? - Vivek Mishra

3 Answers

1
votes

Just a tip, in the bottom of the manifest you can access the "Merged Manifest" to check the errors.

enter image description here

If you can't figure out the erros, post your manifest so we can help.

1
votes

-Try adding this lines to application tag in manifest.

    tools:replace="android:appComponentFactory"
    android:appComponentFactory="androidx"
0
votes

Actually i was using implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+' and the android-image-cropper:2.8.+' is Update to support library to AndroidX. So i just changed the version to this

implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'

Now the app is working fine.