AndroidManifest中的多个ComponentDiscoveryService - >合并冲突

时间:2018-06-13 15:42:05

标签: android firebase unity3d

我正在使用Unity 2018.1.0f2和Firebase 5.0.0。 安装了Android NDK / SDK以及Java 8 172。 我已经为android做了一个力量决心 Firebase消息传递的快速入门项目运行良好,但是,如果我尝试以相同的方式将firebase消息传递到我的项目中,则会引发以下错误:

> 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&) 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) <Module>: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

编辑:额外的堆栈跟踪

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:   <service
      @android:name="com.google.firebase.components.ComponentDiscoveryService">
      <meta-data
--        @android:name="com.google.firebase.components:com.google.firebase.iid.Registrar" <service
      @android:name="com.google.firebase.components.ComponentDiscoveryService">
      <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)

我查看了所有的android清单,并在

中找到了两个相同的声明

E:\路径\ TEMP \ StagingArea \机器人的库\ com.google.firebase.firebase-IID-16.0.0 \的AndroidManifest.xml

<service android:name="com.google.firebase.components.ComponentDiscoveryService" >
    <meta-data
        android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
        android:value="com.google.firebase.components.ComponentRegistrar" />
</service>

E:\路径\ TEMP \ StagingArea \机器人的库\ com.google.firebase.firebase测量连接器-IMPL-16.0.0 \的AndroidManifest.xml

<service android:name="com.google.firebase.components.ComponentDiscoveryService" >
    <meta-data
        android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
        android:value="com.google.firebase.components.ComponentRegistrar" />
</service>

有没有办法自己解决这个问题,我错过了什么或者这是一个firebase错误?

6 个答案:

答案 0 :(得分:1)

YouTube视频我如何修复此错误

https://youtu.be/3Lh6Ci98kfU

答案 1 :(得分:0)

这背后的解决方案似乎是包名变量,它不会被最新版本中的实际包名替换。 https://forum.unity.com/threads/android-gradle-cannot-read-packagename-from-gradleout-src-main-androidmanifest-xml.524587/通过重命名package="${applicationId}"变量来提出临时修复  第4行"\Assets\Plugins\Android\AndroidManifest.xml",实际包名为
例如:package="com.MyCompany.MyGame"

firebase团队现在意识到2018版本的问题,并将很快发布修复

答案 2 :(得分:0)

我找到了

<service android:name="com.google.firebase.components.ComponentDiscoveryService" >

在3个aar文件中,您可以在图片here

中看到

我将上面的所有服务标签合并到一个Android清单文件中并在其他like this中删除然后Unity可以构建APK确定。 我使用Unity 5.6.4p3和Firebase实时数据库SDK 5.0.0

我希望这可以帮助别人,抱歉我的英语不好。

答案 3 :(得分:0)

从我那里待了整整一个星期后,我找到了它。在这种情况下,该问题与SDK最低版本或其他版本无关。发生了一个问题,我将其报告给了Firebase团队,在撰写此答案时,他们发布了 Firebase 5.1.0 ,并且运行正常。

  

解决方案:使用Gradle构建器在内部构建选项中构建游戏   团结建设者行不通。

答案 4 :(得分:0)

Firebase Unity 5.2.0 SDK集成了Play Services Resolver 1.2.79,可解决此问题。

答案 5 :(得分:0)

您的APK文件只能包含一个AndroidManifest.xml文件,但您的Android Studio项目可能包含多个文件,这些文件是由主要源集,构建变体和导入的库提供的。因此,在构建应用程序时,Gradle构建会将所有清单文件合并到一个打包到APK中的清单文件中。

请参见Merge multiple manifest files