gpt4 book ai didi

android - 将 firebase 消息传递服务添加到我的 AndroidManifest.xml 文件时, list 合并失败并出现多个错误

转载 作者:搜寻专家 更新时间:2023-11-01 07:47:53 24 4
gpt4 key购买 nike

我希望将 Firebase 云消息传递添加到我的应用程序中。我关注了codelab这个教程,它在示例应用程序中工作正常,但是当我尝试添加 <service> 时标记到我的应用程序发生 list 合并错误。

奇怪的是它在没有将这些服务添加到我的 list 文件的情况下工作!

这里是错误:

Error:packageName/app/src/main/AndroidManifest.xml:52:9-58:19 Error: Element service#packageName.firebase.MyFirebaseInstanceIdService at AndroidManifest.xml:52:9-58:19 duplicated with element declared at AndroidManifest.xml:44:9-50:19 packageName/app/src/main/AndroidManifest.xml Error: Validation failed, exiting FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:processDebugManifest'. Manifest merger failed with multiple errors, see logs

  • Try: Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

这是我的 AndroidManifest.xml 文件的一部分:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.violete.selfienight">

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

<application
android:name="net.violete.selfienight.leafpic.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme.FullScreen">
<activity
android:name=".CameraActivity"
android:icon="@mipmap/ic_launcher"
android:label="@string/title_camera_activity"
android:screenOrientation="landscape"
android:taskAffinity=".CameraActivity"
android:theme="@style/AppTheme.FullScreen">
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<service
android:name=".firebase.MyFirebaseInstanceIdService"
>
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<service
android:name=".firebase.MyFirebaseInstanceIdService"
>
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
...
</application>
</manifest>

我的问题是,Firebase 库是否在构建过程中将这些标签添加到我的 list 中,或者这里出了什么问题?

最佳答案

您将相同的服务 ( .firebase.MyFirebaseInstanceIdService) 列出了两次。这是行不通的。要么有一个<service>元素包含两个 <intent-filter>元素,或者有两个单独的服务和单独的类。

关于android - 将 firebase 消息传递服务添加到我的 AndroidManifest.xml 文件时, list 合并失败并出现多个错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40116839/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com