1

After adding Firebase Authentication to app implementation I got a Manifest Merger failed error.

"Manifest merger failed with multiple errors, see logs"

I tried using different versions of the authentication but didn't work. The solutions for the same type of problems in StackOverflow didn't work for me.

I tried the suggested changes in Merged manifest but this error came up again

Merging Errors: Error: tools:replace specified at line:6 for attribute android:appComponentFactory, but no new value specified app main manifest (this file), line 5 Error: Validation failed, exiting app main manifest (this file)

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:appComponentFactory">
        <activity android:name=".VerifyEmployeeID"></activity>
        <activity android:name=".SignUp" />
        <activity android:name=".login" />
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'


    implementation 'com.google.firebase:firebase-core:16.0.5'
    implementation 'com.google.firebase:firebase-auth:16.0.5'

    //firebase database
    implementation 'com.google.firebase:firebase-database:16.0.4'

    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'

I need to get rid of this error.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
rathindu_w
  • 611
  • 1
  • 5
  • 12

1 Answers1

1

This happens because you are using simple dependency or androidx support dependency. That's why this error occurs.

Remove below the line in Manifest.xml

tools:replace="android:appComponentFactory"

Use this dependency in build.gradle

implementation 'com.google.firebase:firebase-core:16.0.9'

implementation 'com.google.firebase:firebase-auth:17.0.0'

Remove all androidx dependency in your build.gradle file and sync project.

Community
  • 1
  • 1
Kaushal Panchal
  • 1,785
  • 1
  • 11
  • 27
  • I did the modification you suggested and it worked. What I want to know is how the version of the firebase-core and firebase-auth can do such a difference? What is the basis of using different versions for different problems? – rathindu_w Jul 02 '19 at 12:52
  • My suggestion is to use the latest dependency. But last month Firebase migrates their latest dependancy in androidx and we use third-party dependency which is not used androidx dependancy that's why we have to downgrade the firebase dependancy. Android now migrate to all dependency in androidx in future. so don't worry after someday this problem resolved. for more information visit the Android developer blog. Happy coding. – Kaushal Panchal Jul 03 '19 at 04:30
  • This answer is really helpful! BTW: starts from June 17, 2019, the firebase SDK requires app migrated to androidX: https://firebase.google.com/support/release-notes/android#2019-06-17 – LiuWenbin_NO. Feb 20 '20 at 13:53
  • 1
    Glad to know this answer is useful for you... @LiuWenbin_NO. – Kaushal Panchal Feb 22 '20 at 04:56