简体   繁体   English

Unity无法合并Android清单构建错误

[英]Unity is unable to merge Android manifests build error

In my Unity project, I have imported the plugins: Android Native Plugin and Chartboost. 在我的Unity项目中,我导入了插件: Android Native Plugin和Chartboost。

Before importing the Chartboost unity package, I can successfully build and run on my Android device. 在导入Chartboost统一包之前,我可以在我的Android设备上成功构建和运行。 But after importing the Chartboost package, I get this error when I'm trying to build and run. 但是在导入Chartboost包之后,我在尝试构建和运行时遇到了这个错误。

Here's the build error: 这是构建错误:

Error building Player: CommandInvokationFailure: Unable to merge android manifests. See the Console for more details. 
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/user/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/Unity.app/Contents/BuildTargetTools/AndroidPlayer/sdktools.jar" -

stderr[
Error: [Temp/StagingArea/AndroidManifest-main.xml:8, /Users/user/Documents/Unity Projects/Unity 5.0.0 projects/mygame/Temp/StagingArea/android-libraries/ChartboostSDK/AndroidManifest.xml:11] Trying to merge incompatible /manifest/application/meta-data[@name=com.google.android.gms.version] element:
  <meta-data
      @android:name="com.google.android.gms.version"
--    @android:value="6587000">
  <meta-data
      @android:name="com.google.android.gms.version"
++    @android:value="@integer/google_play_services_version">
Error: [Temp/StagingArea/AndroidManifest-main.xml:8, /Users/user/Documents/Unity Projects/Unity 5.0.0 projects/mygame/Temp/StagingArea/android-libraries/google-play-services_lib/AndroidManifest.xml:5] Trying to merge incompatible /manifest/application/meta-data[@name=com.google.android.gms.version] element:
  <meta-data
      @android:name="com.google.android.gms.version"
--    @android:value="6587000">
  <meta-data
      @android:name="com.google.android.gms.version"
++    @android:value="@integer/google_play_services_version">
]
stdout[

]

Still new to Android development so I'm kinda at a lost. Android开发还是新手,所以我有点迷茫。 I've seen some posts online regarding a similar issue and from what I understand is that whenever using multiple plugins, there would also be multiple manifest files and Unity sometimes fails to combine the manifests due to different/conflicting values. 我在网上看过一些关于类似问题的帖子,据我所知,每当使用多个插件时,也会有多个清单文件,Unity有时因为不同/冲突的值而无法合并清单。

I don't see any values conflicting in the error message though. 我没有看到错误消息中的任何值冲突。 How do I fix this? 我该如何解决? Any help is greatly appreciated. 任何帮助是极大的赞赏。

Update: With the help of Max Yankov, I am able to get past the Unable to merge manifests error . 更新:在Max Yankov的帮助下,我能够通过Unable to merge manifests error But I am now presented with a new error Unable to convert classes into dex format 但我现在遇到一个新错误Unable to convert classes into dex format

Here's the log for that error: 这是该错误的日志:

Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/user/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/Unity.app/Contents/BuildTargetTools/AndroidPlayer/sdktools.jar" -

stderr[

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/actions/SearchIntents;
    at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
    at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
    at com.android.dx.command.dexer.Main.processClass(Main.java:732)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
    at com.android.dx.command.dexer.Main.access$300(Main.java:83)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:632)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at SDKMain.main(SDKMain.java:129)
1 error; aborting
]

stdout[
processing archive bin/classes.jar...
processing com/unity3d/player/a$1.class...
processing com/unity3d/player/a$2.class...
processing com/unity3d/player/a$a.class...
processing com/unity3d/player/a.class...
processing com/unity3d/player/b$1.class...
processing com/unity3d/player/b$2.class...
processing com/unity3d/player/b.class...
processing com/unity3d/player/c.class...
processing com/unity3d/player/d$1.class...
processing com/unity3d/player/d$2.class...
processing com/unity3d/player/d.class...
processing com/unity3d/player/e.class...
processing com/unity3d/player/f.class...
processing com/unity3d/player/g.class...
processing com/unity3d/player/h.class...
processing com/unity3d/player/i.class...
processing com/unity3d/player/j$1.class...
processing com/unity3d/player/j$2$1$1.class...
processing com/unity3d/player/j$2$1.class...
processing com/unity3d/player/j$2.class...
processing com/unity3d/player/j.class...
processing com/unity3d/player/k$1.class...
processing com/unity3d/player/k.class...
processing com/unity3d/player/l.class...
processing com/unity3d/player/m.class...
processing com/unity3d/player/n$1.class...
processing com/unity3d/player/n.class...
processing com/unity3d/player/NativeLoader.class...
processing com/unity3d/player/o.class...
processing com/unity3d/player/ReflectionHelper$1.class...
processing com/unity3d/player/ReflectionHelper$a.class...
processing com/unity3d/player/ReflectionHelper.class...
processing com/unity3d/player/p.class...
processing com/unity3d/player/q$1.class...
processing com/unity3d/player/q$2.class...
processing com/unity3d/player/q$3.class...
processing com/unity3d/player/q.class...
processing com/unity3d/player/r.class...
processing com/unity3d/player/s.class...
processing com/unity3d/player/UnityPlayer$1.class...
processing com/unity3d/player/UnityPlayer$2.class...
processing com/unity3d/player/UnityPlayer$3.class...
processing com/unity3d/player/UnityPlayer$4.class...
processing com/unity3d/player/UnityPlayer$5.class...
processing com/unity3d/player/UnityPlayer$6.class...
processing com/unity3d/player/UnityPlayer$7.class...
processing com/unity3d/player/UnityPlayer$8.class...
processing com/unity3d/player/UnityPlayer$9.class...
processing com/unity3d/player/UnityPlayer$10.class...
processing com/unity3d/player/UnityPlayer$11.class...
processing com/unity3d/player/UnityPlayer$12$1.class...
processing com/unity3d/player/UnityPlayer$12.class...
processing com/unity3d/player/UnityPlayer$13.class...
processing com/unity3d/player/UnityPlayer$14.class...
processing com/unity3d/player/UnityPlayer$15.class...
processing com/unity3d/player/UnityPlayer$16.class...
processing com/unity3d/player/UnityPlayer$17.class...
processing com/unity3d/player/UnityPlayer$18.class...
processing com/unity3d/player/UnityPlayer$a.class...
processing com/unity3d/player/UnityPlayer$b.class...
processing com/unity3d/player/UnityPlayer$c.class...
processing com/unity3d/player/UnityPlayer.class...
processing com/unity3d/player/UnityPlayerActivity.class...
processing com/unity3d/player/UnityPlayerNativeActivity.class...
processing com/unity3d/player/UnityPlayerProxyActivity.class...
processing com/unity3d/player/t.class...
processing com/unity3d/player/u$1.class...
processing com/unity3d/player/u.class...
processing com/unity3d/player/WWW.class...
processing org/fmod/FMODAudioDevice$a.class...
processing org/fmod/FMODAudioDevice.class...
processing org/fmod/a.class...
processing bin/classes/./com/chartboost/sdk/unity/Manifest$permission.class...
processing bin/classes/./com/chartboost/sdk/unity/Manifest.class...
processing bin/classes/./com/chartboost/sdk/unity/R$attr.class...
processing bin/classes/./com/chartboost/sdk/unity/R$bool.class...
processing bin/classes/./com/chartboost/sdk/unity/R$color.class...
processing bin/classes/./com/chartboost/sdk/unity/R$dimen.class...
processing bin/classes/./com/chartboost/sdk/unity/R$drawable.class...
processing bin/classes/./com/chartboost/sdk/unity/R$id.class...
processing bin/classes/./com/chartboost/sdk/unity/R$integer.class...
processing bin/classes/./com/chartboost/sdk/unity/R$layout.class...
processing bin/classes/./com/chartboost/sdk/unity/R$raw.class...
processing bin/classes/./com/chartboost/sdk/unity/R$string.class...
processing bin/classes/./com/chartboost/sdk/unity/R$style.class...
processing bin/classes/./com/chartboost/sdk/unity/R$styleable.class...
processing bin/classes/./com/chartboost/sdk/unity/R$xml.class...
processing bin/classes/./com/chartboost/sdk/unity/R.class...
processing bin/classes/./com/facebook/android/Manifest$permission.class...
processing bin/classes/./com/facebook/android/Manifest.class...
processing bin/classes/./com/facebook/android/R$attr.class...
processing bin/classes/./com/facebook/android/R$bool.class...
processing bin/classes/./com/facebook/android/R$color.class...
processing bin/classes/./com/facebook/android/R$dimen.class...
processing bin/classes/./com/facebook/android/R$drawable.class...
processing bin/classes/./com/facebook/android/R$id.class...
processing bin/classes/./com/facebook/android/R$integer.class...
processing bin/classes/./com/facebook/android/R$layout.class...
processing bin/classes/./com/facebook/android/R$raw.class...
processing bin/classes/./com/facebook/android/R$string.class...
processing bin/classes/./com/facebook/android/R$style.class...
processing bin/classes/./com/facebook/android/R$styleable.class...
processing bin/classes/./com/facebook/android/R$xml.class...
processing bin/classes/./com/facebook/android/R.class...
processing bin/classes/./com/google/android/gms/Manifest$permission.class...
processing bin/classes/./com/google/android/gms/Manifest.class...
processing bin/classes/./com/google/android/gms/R$attr.class...
processing bin/classes/./com/google/android/gms/R$bool.class...
processing bin/classes/./com/google/android/gms/R$color.class...
processing bin/classes/./com/google/android/gms/R$dimen.class...
processing bin/classes/./com/google/android/gms/R$drawable.class...
processing bin/classes/./com/google/android/gms/R$id.class...
processing bin/classes/./com/google/android/gms/R$integer.class...
processing bin/classes/./com/google/android/gms/R$layout.class...
processing bin/classes/./com/google/android/gms/R$raw.class...
processing bin/classes/./com/google/android/gms/R$string.class...
processing bin/classes/./com/google/android/gms/R$style.class...
processing bin/classes/./com/google/android/gms/R$styleable.class...
processing bin/classes/./com/google/android/gms/R$xml.class...
processing bin/classes/./com/google/android/gms/R.class...
processing bin/classes/./com/test/asdf/Manifest$permission.class...
processing bin/classes/./com/test/asdf/Manifest.class...
processing bin/classes/./com/test/asdf/R$attr.class...
processing bin/classes/./com/test/asdf/R$bool.class...
processing bin/classes/./com/test/asdf/R$color.class...
processing bin/classes/./com/test/asdf/R$dimen.class...
processing bin/classes/./com/test/asdf/R$drawable.class...
processing bin/classes/./com/test/asdf/R$id.class...
processing bin/classes/./com/test/asdf/R$integer.class...
processing bin/classes/./com/test/asdf/R$layout.class...
processing bin/classes/./com/test/asdf/R$raw.class...
processing bin/classes/./com/test/asdf/R$string.class...
processing bin/classes/./com/test/asdf/R$style.class...
processing bin/classes/./com/test/asdf/R$styleable.class...
processing bin/classes/./com/test/asdf/R$xml.class...
processing bin/classes/./com/test/asdf/R.class...
processing archive plugins/./an_billing.jar...
ignored resource META-INF/MANIFEST.MF
processing com/android/vending/billing/IInAppBillingService$Stub$Proxy.class...
processing com/android/vending/billing/IInAppBillingService$Stub.class...
processing com/android/vending/billing/IInAppBillingService.class...
processing com/androidnative/billing/core/AN_BillingProxyActivity$1.class...
processing com/androidnative/billing/core/AN_BillingProxyActivity.class...
processing com/androidnative/billing/core/BillingHelper$1.class...
processing com/androidnative/billing/core/BillingHelper$2$1.class...
processing com/androidnative/billing/core/BillingHelper$2.class...
processing com/androidnative/billing/core/BillingHelper$3$1.class...
processing com/androidnative/billing/core/BillingHelper$3$2.class...
processing com/androidnative/billing/core/BillingHelper$3.class...
processing com/androidnative/billing/core/BillingHelper.class...
processing com/androidnative/billing/core/BillingManager$1.class...
processing com/androidnative/billing/core/BillingManager$2.class...
processing com/androidnative/billing/core/BillingManager$3.class...
processing com/androidnative/billing/core/BillingManager.class...
processing com/androidnative/billing/core/listeners/AN_PurchaseFinishedListener.class...
processing com/androidnative/billing/core/listeners/AN_QueryInventoryFinishedListener.class...
processing com/androidnative/billing/interfaces/OnBillingPurchaseFinishedListener.class...
processing com/androidnative/billing/interfaces/OnBillingSetupFinishedListener.class...
processing com/androidnative/billing/interfaces/OnConsumeFinishedListener.class...
processing com/androidnative/billing/interfaces/OnConsumeMultiFinishedListener.class...
processing com/androidnative/billing/interfaces/QueryInventoryFinishedListener.class...
processing com/androidnative/billing/models/BillingException.class...
processing com/androidnative/billing/models/BillingResult.class...
processing com/androidnative/billing/models/Inventory.class...
processing com/androidnative/billing/models/Purchase.class...
processing com/androidnative/billing/models/Security.class...
processing com/androidnative/billing/models/SkuDetails.class...
processing com/androidnative/billing/util/Base64.class...
processing com/androidnative/billing/util/Base64DecoderException.class...
processing archive plugins/./an_googleplay.jar...
ignored resource META-INF/MANIFEST.MF
processing com/androidnative/an_googleplay/BuildConfig.class...
processing com/androidnative/an_googleplay/R$attr.class...
processing com/androidnative/an_googleplay/R$drawable.class...
processing com/androidnative/an_googleplay/R$id.class...
processing com/androidnative/an_googleplay/R$layout.class...
processing com/androidnative/an_googleplay/R$string.class...
processing com/androidnative/an_googleplay/R$style.class...
processing com/androidnative/an_googleplay/R.class...
processing com/androidnative/gcm/ANCloudMessageService$1.class...
processing com/androidnative/gcm/ANCloudMessageService$2.class...
processing com/androidnative/gcm/ANCloudMessageService.class...
processing com/androidnative/gcm/GcmBroadcastReceiver.class...
processing com/androidnative/gcm/GcmIntentService.class...
processing com/androidnative/gms/ad/ANMobileAd.class...
processing com/androidnative/gms/ad/AdInAppListner.class...
processing com/androidnative/gms/ad/BannerAdListner.class...
processing com/androidnative/gms/ad/GADBanner.class...
processing com/androidnative/gms/ad/InterstitialAdListner.class...
processing com/androidnative/gms/analytics/AN_AnalyticsProxy.class...
processing com/androidnative/gms/analytics/V4GoogleAnalytics.class...
processing com/androidnative/gms/core/GameClientBridge.class...
processing com/androidnative/gms/core/GameClientManager$1.class...
processing com/androidnative/gms/core/GameClientManager$2.class...
processing com/androidnative/gms/core/GameClientManager$3.class...
processing com/androidnative/gms/core/GameClientManager$4.class...
processing com/androidnative/gms/core/GameClientManager$5.class...
processing com/androidnative/gms/core/GameClientManager.class...
processing com/androidnative/gms/core/GameInvitationManager.class...
processing com/androidnative/gms/core/GooglePlaySupportActivity$1.class...
processing com/androidnative/gms/core/GooglePlaySupportActivity.class...
processing com/androidnative/gms/core/NewGameHelper.class...
processing com/androidnative/gms/listeners/appstate/StateDeleteListener.class...
processing com/androidnative/gms/listeners/appstate/StateUpdateListener.class...
processing com/androidnative/gms/listeners/appstate/StatesLoadedListener.class...
processing com/androidnative/gms/listeners/games/AchievementsLoadListner.class...
processing com/androidnative/gms/listeners/games/AchievementsUpdateListner.class...
processing com/androidnative/gms/listeners/games/LeaderBoardScoreLoaded.class...
processing com/androidnative/gms/listeners/games/LeaderBoardsLoadedListener.class...
processing com/androidnative/gms/listeners/games/PlayerResultListner.class...
processing com/androidnative/gms/listeners/games/PlayerScoreUpdateListner.class...
processing com/androidnative/gms/listeners/games/ScoreSubmitedListner.class...
processing com/androidnative/gms/listeners/network/AN_OnInvitationReceivedListener.class...
processing com/androidnative/gms/listeners/network/AN_RealTimeMessageReceivedListener.class...
processing com/androidnative/gms/listeners/network/AN_RoomStatusUpdateListener.class...
processing com/androidnative/gms/listeners/network/AN_RoomUpdateListener.class...
processing com/androidnative/gms/listeners/quests/AN_AcceptQuestResultListner.class...
processing com/androidnative/gms/listeners/quests/AN_ClaimMilestoneResult.class...
processing com/androidnative/gms/listeners/quests/AN_EventsLoadListner.class...
processing com/androidnative/gms/listeners/quests/AN_LoadQuestsResult.class...
processing com/androidnative/gms/listeners/quests/AN_QuestUpdateListener.class...
processing com/androidnative/gms/listeners/requests/AN_LoadRequestsResultListner.class...
processing com/androidnative/gms/listeners/requests/AN_UpdateRequestsResultListner.class...
processing com/androidnative/gms/listeners/savedgames/DeleteSnapShotListner.class...
processing com/androidnative/gms/listeners/savedgames/DeleteSpapShotResultListner.class...
processing com/androidnative/gms/listeners/savedgames/LoadSnapshotsResultListner.class...
processing com/androidnative/gms/listeners/savedgames/OpenSnapshotListner.class...
processing com/androidnative/gms/listeners/savedgames/SnapshotCreateListner.class...
processing com/androidnative/gms/listeners/savedgames/SnapshotMetadataChangeListner.class...
processing com/androidnative/<message truncated>

It looks like one of the plugins is saving the value of com.google.android.gms.version in the AndroidManifest.xml itself, and the other uses a string resource ; 看起来其中一个插件正在AndroidManifest.xml本身保存com.google.android.gms.version的值,另一个使用字符串资源 ; I suppose that there's a file integer.xml somewhere in the source, and when you find it, there would be a value of google_play_services_version hidden inside. 我想在源代码的某处有一个文件integer.xml ,当你找到它时,里面会隐藏google_play_services_version的值。 The com.google.android.gms.version itself seems to be a required version of Google Play Services; com.google.android.gms.version本身似乎是Google Play服务的必需版本; it's reasonable that it would be backward compatible, so I would just pick the largest number out of those two. 它向后兼容是合理的,所以我只选择这两者中最大的数字。 Check this for details (switch to "Something else" to see the configuration details). 检查这一点以获取详细信息(切换到“其他”以查看配置详细信息)。

For your second question: 对于你的第二个问题:

This is most likely a result of having duplicate .jar files in your project. 这很可能是因为项目中存在重复的.jar文件。

See this answer for more information. 有关更多信息,请参阅此答案

its very much straightforward, you need to navigate to location: \\Assets\\Plugins\\Android. 非常简单,你需要导航到位置:\\ Assets \\ Plugins \\ Android。 Locate all AndroidManifest.xml files and update the sdk version as per the given error. 找到所有AndroidManifest.xml文件并根据给定的错误更新sdk版本。

1 - (If you are VR developer)download "tools_r25.2.3-windows.zip" from " https://developer.android.com/studio/index.html " then replace it with tools folder in your Android Studio folder!!! 1 - (如果您是VR开发人员)从“ https://developer.android.com/studio/index.html ”下载“tools_r25.2.3-windows.zip”,然后将其替换为Android Studio文件夹中的tools文件夹! !

2 - You should work with unity version 5.5.0! 2 - 你应该使用统一版本5.5.0! the version 5.6.x doesn't work really good!! 版本5.6.x不能很好用!!

3 - the best version for gvr-unity-sdk(If you are VR developer) is 1.0.3! 3 - gvr-unity-sdk的最佳版本(如果你是VR开发人员)是1.0.3! The greater doesn't work good!!! 越大越好不行!!!

4 - (If you are VR developer)Right click on "My Computer" and select "Properties"/Go to "Advanced System setting"/Click "Environment Variables"/In "system variables" look for "Path" click on it then click "Edit" . 4 - (如果您是VR开发人员)右键单击“我的电脑”并选择“属性”/进入“高级系统设置”/单击“环境变量”/在“系统变量”中查找“路径”然后单击它然后单击“编辑”。 In "variable value" add a semicolon sign(;) to the end of default path, then add the path of where u install Android Studio/platform-tools folder for example my path is "G:\\AndroidSDK\\platform-tools"....... 在“变量值”中,在默认路径的末尾添加分号(;),然后添加安装Android Studio / platform-tools文件夹的路径,例如我的路径是“G:\\ AndroidSDK \\ platform-tools”。 ......

I hope your problem will be solved!!! 我希望你的问题能够得到解决!

Hi Guys I had an exact similar problem and the Unity thread I mean this link and this one said that update and change the API level and follow up the crap, I also highly recommend to update the android SKD and set JAVA_HOME and ANDROID_HOME in your system variables like me in the following picture 嗨,大家好我有一个确切的类似的问题,统一螺纹我的意思是这个环节 ,这一个说,更新和更改API级别和跟进废话,我也强烈推荐更新的Android SKD并在系统中设置JAVA_HOME和ANDROID_HOME像下面的图片中的变量

在此输入图像描述

and set path variables for adb.exe and java.exe in your system like this one 并为您的系统中的adb.exe和java.exe设置路径变量,如下所示

在此输入图像描述

BUT what I tried and fixed my problem was that I changed the build system to new Gradle ! 但是我尝试并解决了我的问题是我将构建系统更改为新的Gradle and that was it. 就是这样。

在此输入图像描述

Cheers =) 干杯=)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM