Unity3d无法在编译时合并多个Android清单

时间:2018-10-20 06:24:22

标签: android unity3d

我最近开始了一个项目,并尝试从Firebase中添加一些软件包。问题是当我试图建立一个android导出单位时,无法合并项目中包含的android清单文件。 (我不确定,但是似乎在解决冲突时它不起作用,因为在每次构建时,团结会删除清单文件并重建具有相同冲突问题的清单,但也许我不能很好地处理冲突。)

这是错误:

CommandInvokationFailure: Unable to merge android manifests. See the Console for more details. 
C:\Program Files\Java\jdk1.8.0_25\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="E:\sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[
Error: [Temp\StagingArea\AndroidManifest-main.xml, E:\unity_projects\clones_project\my2048\2048-final\Temp\StagingArea\android-libraries\com.google.firebase.firebase-iid-17.0.2\AndroidManifest.xml:12] 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.auth.FirebaseAuthRegistrar"
  <service
++    @android:exported="false"
++    @android:name="com.google.firebase.components.ComponentDiscoveryService">
++    <meta-data
Error: [Temp\StagingArea\AndroidManifest-main.xml, E:\unity_projects\clones_project\my2048\2048-final\Temp\StagingArea\android-libraries\com.google.firebase.firebase-measurement-connector-impl-17.0.1\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.auth.FirebaseAuthRegistrar"
  <service
      @android:name="com.google.firebase.components.ComponentDiscoveryService">
      <meta-data
++        @android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
]
stdout[
Warning: [Temp\StagingArea\AndroidManifest-main.xml:13, E:\unity_projects\clones_project\my2048\2048-final\Temp\StagingArea\android-libraries\android.arch.lifecycle.runtime-1.0.0\AndroidManifest.xml:3] Main manifest has <uses-sdk android:targetSdkVersion='25'> but library uses targetSdkVersion='26'
[Temp\StagingArea\AndroidManifest-main.xml, E:\unity_projects\clones_project\my2048\2048-final\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:\unity_projects\clones_project\my2048\2048-final\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:\unity_projects\clones_project\my2048\2048-final\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:\unity_projects\clones_project\my2048\2048-final\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:\unity_projects\clones_project\my2048\2048-final\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:\unity_projects\clones_project\my2048\2048-final\Temp\StagingArea\android-libraries\com.google.firebase.firebase-analytics-impl-16.2.1\AndroidManifest.xml:12] Skipping identical /manifest/application/receiver[@name=com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver] element.
Warning: [Temp\StagingArea\AndroidManifest-main.xml:13, E:\unity_projects\clones_project\my2048\2048-final\Temp\StagingArea\android-libraries\com.google.firebase.firebase-common-16.0.2\AndroidManifest.xml:2] Main manifest has <uses-sdk android:targetSdkVersion='25'> but library uses targetSdkVersion='26'
]
exit code: 1
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.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.HostView:OnGUI()

1 个答案:

答案 0 :(得分:0)

您可以尝试使用Gradle系统。如果仍然无法使用,则将项目导出到Android Studio。它将使您对问题有更好的了解。然后,您可以直接从Android Studio中解决这些错误。

确保已从资产> Play服务解析器> Android>强制解析导入了所需的库。