【问题标题】:Manifest merger Failed after adding Google Firebase Authentication添加 Google Firebase 身份验证后清单合并失败
【发布时间】:2019-07-02 11:24:48
【问题描述】:

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

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

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

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

合并错误:错误:工具:在第 6 行指定的替换 属性android:appComponentFactory,但没有新值指定app 主清单(此文件),第 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'

我需要摆脱这个错误。

【问题讨论】:

  • 请将您已添加到firebase的代码sn-p添加到身份验证中
  • 迁移到 androidx 它将解决您的清单合并问题:developer.android.com/jetpack/androidx/migrate
  • 支持androidx包的最新firebase库是显示错误的原因

标签: android firebase-authentication android-manifest manifest-merging


【解决方案1】:

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

删除 Manifest.xml

中的行下方

tools:replace="android:appComponentFactory"

build.gradle

中使用此依赖项

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

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

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

【讨论】:

  • 我做了你建议的修改,它工作。我想知道的是 firebase-core 和 firebase-auth 的版本如何能做到这样的差异?针对不同问题使用不同版本的依据是什么?
  • 我的建议是使用最新的依赖。但是上个月 Firebase 迁移了他们在 androidx 中的最新依赖项,我们使用了未使用 androidx 依赖项的第三方依赖项,这就是我们必须降级 firebase 依赖项的原因。 Android 现在会迁移到 androidx 中的所有依赖项。所以不要担心有一天这个问题解决了。欲了解更多信息,请访问 Android 开发者博客。编码愉快。
  • 这个答案真的很有帮助! BTW:从 2019 年 6 月 17 日开始,firebase SDK 需要将应用迁移到 androidX:firebase.google.com/support/release-notes/android#2019-06-17
  • 很高兴知道这个答案对你有用...@LiuWenbin_NO.
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-02-14
  • 1970-01-01
  • 2017-11-27
  • 2020-09-23
  • 2020-07-09
  • 1970-01-01
相关资源
最近更新 更多