(Unity3d) Chartboost 和 Admob 无法兼容

(Unity3d) Chartboost and Admob can't Compatible

我的游戏里已经有Admob插件设置,我也想设置Chartboost插件。当我设置 Chartboost 插件时,我无法制作 apk 包

CommandInvokationFailure: Failed to re-package resources. D:\Android\sdk\build-tools.0.1\aapt.exe package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "D:/Android/sdk\platforms\android-25\android.jar" -F bin/resources.ap_ --extra-packages android.support.v7.appcompat:com.unity3d.player:com.unity.purchasing:com.android.vending.billing:com.google.unity.ads:com.unity.purchasing.googleplay:com.google.example.games.mainlibproj:com.google.android.gms.ads.impl:com.google.android.gms.ads:com.google.android.gms.auth.api:com.google.android.gms.auth:com.google.android.gms.base:com.google.android.gms:com.google.android.gms:com.google.android.gms.clearcut:com.google.android.gms.drive:com.google.android.gms.games:com.google.android.gms.gass:com.google.android.gms.nearby:com.google.android.gms.tasks:android.support.v4:com.unity3d.ads:com.pushok.test -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\common\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\GoogleAIDL\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\GooglePlay\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-ads-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-ads-lite-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-auth-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-auth-base-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-base-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-basement-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-basement-9.0.0\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-clearcut-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-drive-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-games-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-gass-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-nearby-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\play-services-tasks-10.0.1\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\support-v4-24.0.0\res" -S "E:\unityWork\MySlots\SlotsGame\Temp\StagingArea\android-libraries\UnityAds\res"

似乎是文件 AndroidManifest.xml 造成了这个错误。

当您有一个 AndroidManifest.xml 文件(可能在 Plugins/Android 下或该文件夹的子文件夹中的插件)试图通过名称访问资源时,您的错误 CommandInvokationFailure: Failed to re-package resources. 可能会发生(google_play_services_version),但此值从未在任何地方定义。通常,此值是通过某种方法添加的,例如将其添加到 AndroidManifest.xml 或添加到 res/values.

下的 xml

另一种解决方法是:

To fix this error, you have to copy the version.xml file from

android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/res/values/

into Assets/Plugins/Android/res/values/ of your Unity project's folder.

额外资源:

我做了一个备份,所以我使用 git 来查找我的项目中发生了什么变化。

我发现当我设置Chartboost(点击'Setup Android SDK'按钮)时,添加了一个文件play-services-basement-9.0.0.aar,而我已经有play-services-basement-10.0.0.aar。所以我删除了9.0。 0 文件。

现在可以制作apk包了!