1

将 Firebase 身份验证添加到应用程序实现后,我收到了 Manifest Merger failed 错误。

“清单合并失败并出现多个错误,请参阅日志”

我尝试使用不同版本的身份验证,但没有奏效。StackOverflow 中相同类型问题的解决方案对我不起作用。

我尝试了合并清单中的建议更改,但再次出现此错误

合并错误:错误:工具:在第 6 行指定属性 android:appComponentFactory,但没有指定新值应用程序主清单(此文件),第 5 行错误:验证失败,退出应用程序主清单(此文件)

    <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'

我需要摆脱这个错误。

4

1 回答 1

1

发生这种情况是因为您使用的是简单依赖项或 androidx 支持依赖项。这就是发生此错误的原因。

删除Manifest.xml中的行下方

工具:replace="android:appComponentFactory"

在build.gradle中使用这个依赖

实施 'com.google.firebase:firebase-core:16.0.9'

实施 'com.google.firebase:firebase-auth:17.0.0'

删除build.gradle文件中的所有 androidx 依赖项并同步项目。

于 2019-07-02T11:54:53.790 回答