title: Multiple ComponentDiscoveryService in AndroidManifest --> merge conflict
body: <p>I am using Unity 2018.1.0f2 and Firebase 5.0.0.
  Android NDK/SDK is installed as well as Java 8 172.
  I already did a force resolve for android
  The quick starter project for Firebase messaging runs well, however, if I try to implement firebase messaging in the same way into my project the following error is  thrown:</p>
  
  <pre><code>&gt; Error: [Temp\StagingArea\AndroidManifest-main.xml, E:\path\Temp\StagingArea\android-libraries\com.google.firebase.firebase-measurement-connector-impl-16.0.0\AndroidManifest.xml:10] Trying to merge incompatible /manifest/application/service[@name=com.google.firebase.components.ComponentDiscoveryService] element:
  
  0x00000001414F00A9 (Unity) StackWalker::GetCurrentCallstack 0x00000001414F66B6 (Unity) StackWalker::ShowCallstack 0x000000014138F54B (Unity) GetStacktrace 0x0000000140888ADC (Unity) DebugStringToFile 0x0000000141F886A8 (Unity) DebugLogHandler_CUSTOM_Internal_Log 0x0000000052EE344B (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,string,UnityEngine.Object) 0x0000000052EE3334 (Mono JIT Code) [DebugLogHandler.cs:9] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])  0x0000000052EE2C35 (Mono JIT Code) [Logger.cs:47] UnityEngine.Logger:Log (UnityEngine.LogType,object)  0x0000000052EE2953 (Mono JIT Code) [Debug.bindings.cs:117] UnityEngine.Debug:LogError (object)  0x000000004BE988E0 (Mono JIT Code) UnityEditor.Android.PostProcessor.PostProcessRunner:RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext) 0x0000000052EB7664 (Mono JIT Code) UnityEditor.Android.PostProcessAndroidPlayer:PostProcess (UnityEditor.BuildTarget,string,string,string,string,string,string,UnityEditor.BuildOptions,UnityEditor.RuntimeClassRegistry,UnityEditor.Build.Reporting.BuildReport) 0x0000000052EB613A (Mono JIT Code) UnityEditor.Android.AndroidBuildPostprocessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&amp;) 0x0000000052EB5822 (Mono JIT Code) [PostprocessBuildPlayer.cs:285] UnityEditor.PostprocessBuildPlayer:Postprocess (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,string,string,string,int,int,UnityEditor.BuildOptions,UnityEditor.RuntimeClassRegistry,UnityEditor.Build.Reporting.BuildReport) 0x0000000052EB5C6E (Mono JIT Code) (wrapper runtime-invoke) &lt;Module&gt;:runtime_invoke_void_int_int_object_object_object_int_int_int_object_object (object,intptr,intptr,intptr) 0x00007FF8C318668F (mono) [mini.c:4937] mono_jit_runtime_invoke  0x00007FF8C30D8A95 (mono) [object.c:2623] mono_runtime_invoke  0x0000000140BDDC2A (Unity) scripting_method_invoke 0x0000000140BD67F0 (Unity) ScriptingInvocation::Invoke 0x0000000140D5A82F (Unity) CallMono 0x0000000140D653E0 (Unity) PostprocessPlayer 0x0000000140D5DC29 (Unity) DoBuildPlayer_PostBuild 0x0000000140D5D3CC (Unity) DoBuildPlayer 0x0000000140D50787 (Unity) BuildPlayer 0x00000001415164A0 (Unity) BuildPipeline_CUSTOM_BuildPlayerInternalNoCheck 0x000000004BE317E7 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,UnityEditor.BuildOptions,bool) 0x000000004BE30E30 (Mono JIT Code) [BuildPlayerWindowBuildMethods.cs:165] UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)  0x000000004BE2D48B (Mono JIT Code) [BuildPlayerWindowBuildMethods.cs:89] UnityEditor.BuildPlayerWindow:CallBuildMethods (bool,UnityEditor.BuildOptions)  0x000000004BE2CDEC (Mono JIT Code) [BuildPlayerWindow.cs:181] UnityEditor.BuildPlayerWindow:BuildPlayerAndRun (bool)  0x000000004BE2C98C (Mono JIT Code) [BuildPlayerWindow.cs:175] UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()  0x00000000008F11DE (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr) 0x00007FF8C318668F (mono) [mini.c:4937] mono_jit_runtime_invoke  0x00007FF8C30D8A95 (mono) [object.c:2623] mono_runtime_invoke  0x0000000140BD4CF7 (Unity) CallStaticMonoMethod 0x0000000140BD4A7E (Unity) CallStaticMonoMethod 0x0000000140D5732F (Unity) BuildPlayerWithLastSettings 0x00000001415B8EC1 (Unity) ResourceDrivenMenus::Execute 0x000000014133EDC8 (Unity) MenuController::ExecuteMenuItem 0x00000001415C49E5 (Unity) ProcessMainWindowMessages 0x00000001415A1DF5 (Unity) ContainerWindow::ContainerWndProc 0x00007FF8EE2B6CC1 (USER32) CallWindowProcW 0x00007FF8EE2B6693 (USER32) DispatchMessageW 0x00000001415C4261 (Unity) MainMessageLoop 0x00000001415C65DC (Unity) WinMain 0x000000014271FDA7 (Unity) __scrt_common_main_seh 0x00007FF8EE913034 (KERNEL32) BaseThreadInitThunk 0x00007FF8EF361431 (ntdll) RtlUserThreadStart
  </code></pre>
  
  <p>Edit: additional stack trace</p>
  
  <pre><code>CommandInvokationFailure: Unable to merge android manifests.  C:/Program Files/Java/jdk1.8.0_172\bin\java.exe -Xmx2048M
  -Dcom.android.sdkmanager.toolsdir="E:/AndroidSDK\tools" -Dfile.encoding=UTF8 -jar "E:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar"
  -
  
  stderr[ Error: [Temp\StagingArea\AndroidManifest-main.xml, E:\path\Temp\StagingArea\android-libraries\com.google.firebase.firebase-measurement-connector-impl-16.0.0\AndroidManifest.xml:10] Trying to merge incompatible /manifest/application/service[@name=com.google.firebase.components.ComponentDiscoveryService] element:   &lt;service
        @android:name="com.google.firebase.components.ComponentDiscoveryService"&gt;
        &lt;meta-data
  --        @android:name="com.google.firebase.components:com.google.firebase.iid.Registrar" &lt;service
        @android:name="com.google.firebase.components.ComponentDiscoveryService"&gt;
        &lt;meta-data
  ++        @android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar" ] stdout[ [Temp\StagingArea\AndroidManifest-main.xml, E:\path\Temp\StagingArea\android-libraries\com.android.support.support-core-ui-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, E:\path\Temp\StagingArea\android-libraries\com.android.support.support-core-utils-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, E:\path\Temp\StagingArea\android-libraries\com.android.support.support-fragment-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, E:\path\Temp\StagingArea\android-libraries\com.android.support.support-media-compat-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, E:\path\Temp\StagingArea\android-libraries\com.android.support.support-v4-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, E:\path\Temp\StagingArea\android-libraries\com.google.firebase.firebase-analytics-impl-16.0.0\AndroidManifest.xml:15] Skipping identical /manifest/application/service[@name=com.google.android.gms.measurement.AppMeasurementService] element. [Temp\StagingArea\AndroidManifest-main.xml, E:\path\Temp\StagingArea\android-libraries\com.google.firebase.firebase-analytics-impl-16.0.0\AndroidManifest.xml:12] Skipping identical /manifest/application/receiver[@name=com.google.android.gms.measurement.AppMeasurementReceiver] element. ] exit code: 1 UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.RunCommand (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
  </code></pre>
  
  <p>I looked over all the android manifests and found two same declarations in </p>
  
  <p>E:\path\Temp\StagingArea\android-libraries\com.google.firebase.firebase-iid-16.0.0\AndroidManifest.xml</p>
  
  <pre><code>&lt;service android:name="com.google.firebase.components.ComponentDiscoveryService" &gt;
      &lt;meta-data
          android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
          android:value="com.google.firebase.components.ComponentRegistrar" /&gt;
  &lt;/service&gt;
  </code></pre>
  
  <p>and</p>
  
  <p>E:\path\Temp\StagingArea\android-libraries\com.google.firebase.firebase-measurement-connector-impl-16.0.0\AndroidManifest.xml</p>
  
  <pre><code>&lt;service android:name="com.google.firebase.components.ComponentDiscoveryService" &gt;
      &lt;meta-data
          android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
          android:value="com.google.firebase.components.ComponentRegistrar" /&gt;
  &lt;/service&gt;
  </code></pre>
  
  <p>Is there a way to fix this by myself, am I missing something or is this a firebase bug?</p>