【问题标题】:Manifest Merger Failed When Trying to Update to Latest FirebaseUI尝试更新到最新的 FirebaseUI 时清单合并失败
【发布时间】:2017-11-23 06:53:48
【问题描述】:

我正在尝试将最新的 FirebaseUI 依赖项添加到我的 Android 项目中。我在我的项目中启用了 Facebook 登录,当我设置 Facebook 登录时,我需要在 Android 清单中添加我的 Facebook 应用程序 ID。这是我添加到我的 android 项目中的依赖项:

"com.firebaseui:firebase-ui:3.0.0"

编译后收到如下错误:

Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute meta-data#com.facebook.sdk.ApplicationId@value value=() from AndroidManifest.xml:29:13-52
is also present at [com.firebaseui:firebase-ui-auth:3.0.0] AndroidManifest.xml:21:13-60 value=().
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:27:9-29:55 to override.

我不确定为什么系统提示我更改我的 Facebook 应用 ID 以使用最新的库。我正在更新,以便我可以利用新的 FirebaseUI 功能和 Firebase Cloud Firestore。

清单

  <uses-permission android:name="android.permission.INTERNET" />

<application
    android:name="android.support.multidex.MultiDexApplication"
    android:allowBackup="true"
    android:icon="@drawable/xxxxxxx"
    android:label="@string/xxxxxxx"
    android:theme="@style/AppTheme.NoActionBar"> <!-- ADD THIS LINE -->

    <activity
        android:name=".SignupActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="adjustPan" />
    <activity
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar"
        tools:replace="android:theme" />

    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id" />
    <meta-data
        android:name="com.firebase.ui.GoogleClientId"
        android:value="@string/google_client_id" />
    <meta-data
        android:name="com.firebase.ui.TwitterKey"
        android:value="@string/twitter_app_key" />
    <meta-data
        android:name="com.firebase.ui.TwitterSecret"
        android:value="@string/twitter_app_secret" />

    <activity
        android:name=".PollHostActivity"
        android:label="@string/title_activity_poll"
        android:launchMode="singleTask"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="adjustPan" />
    <activity
        android:name=".LoadingActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".HomeActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".CreateActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".NewImageActivity"
        android:theme="@style/AppTheme">
        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>

        <meta-data
            android:name="android.app.searchable"
            android:resource="@xml/searchable" />
    </activity>
    <activity
        android:name=".ProfileActivity"
        android:label="@string/title_activity_profile"
        android:theme="@style/AppTheme.NoActionBar"></activity>
</application>

【问题讨论】:

    标签: java android firebase firebaseui


    【解决方案1】:

    您的帖子说:当我设置 Facebook 登录时,我需要在 Android 清单中添加我的 Facebook 应用 IDfirebase-ui-auth:3.1.0 不是这种情况,也可能不是 3.0.0。在 3.1.0 中,您将 ID 定义为字符串资源 as described here,FirebaseUI 会生成所需的清单条目,这些条目会在构建时合并到主清单中。如果您在清单中手动定义常量,则可能是合并冲突的原因。

    要查看 contributors to the merged manifest,请在 Android Studio 中打开您的 AndroidManifest.xml 文件。单击窗口底部的 Merged Manifest 选项卡。在右侧窗格中,找到并单击 firebase-ui-auth:3.0.0 以查看由 FirebaseUI 生成的用于合并到复合清单中的清单条目。如果您在那里看到您手动输入清单的 meta-data 条目,请删除您的条目以消除合并冲突。

    【讨论】:

    • 我认为我可能遇到的另一个问题是我正在使用 Firebase-auth,我应该使用 FirebaseUI-auth?
    • @tccpg288:这可能是一个因素;我不知道。我确实记得读过最好只使用所需的特定库,例如firebase-ui-auth,而不是包罗万象的firebase-ui
    【解决方案2】:

    尝试遵循他们的 GitHub 自述文件,位于 here。我也遇到了同样的问题,我的问题引起了很多关注,但不幸的是,没有人能指出问题所在。问题出在您正在编写此“com.firebaseui:firebase-ui:3.0.0”的 gradle 文件中。

    【讨论】:

    • 是的,当然。为了更好地理解它,我开始了一个全新的项目,并一步一步地按照自述文件进行操作。我对结果非常满意。向开发人员致敬,它就像一个魅力。
    • 知道了,所以基本上我可能需要在 Firebase 中创建一个新项目和一个新的 Facebook 应用 ID?只是对“重新开始”需要什么感到困惑。
    • 同一个 repo 的两个版本在您的项目中的某个地方发生冲突,很可能是 Firebase。如果您无法重新开始,只需阅读自述文件一次,您将了解需要重新开始的步骤。
    • 如果您只是想了解 Firebase 身份验证,我建议您阅读由 Firebase 开发人员提供的这个很好的教程 here
    猜你喜欢
    • 2018-02-18
    • 1970-01-01
    • 1970-01-01
    • 2018-03-11
    • 1970-01-01
    • 2017-09-03
    • 1970-01-01
    • 2019-11-02
    相关资源
    最近更新 更多