私はFirebaseクラウドメッセージングを自分のアプリに追加したいと考えていました。私はこのためにcodelabチュートリアルを続け、サンプルアプリケーションで正しく動作していましたが、私のアプリケーションに<service>
タグを追加しようとすると、マニフェスト合併エラーが発生します。AndroidManifest.xmlファイルにfirebaseメッセージングサービスを追加すると、マニフェストの合併が複数のエラーで失敗しました
奇妙な部分は、私のマニフェストファイルにそれらのサービスを追加せずに働いているということです!ここで
は、それは誤りです:
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ライブラリがビルド時に私のマニフェストにこれらのタグを追加するかどうかここで何かが間違っていますか?
私の目には医者が必要だと思います!どうもありがとうございます! –
マニフェストにサービスを追加しなくても通知がなぜ表示されると思いますか?それは不思議ではないですか? –
@NavidEivazzadeh:申し訳ありませんが、私はそのコメントを理解していません。 – CommonsWare