Unity Admob和Google Play游戏服务集成

时间:2014-09-06 14:09:07

标签: android unity3d admob integration google-play-games

我试图在我的游戏中集成admob和Google Play游戏服务,但我遇到了问题。我无法建立游戏。控制台出错:

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
D:\android-studio\sdk\build-tools\android-4.4W\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "D:/android-studio/sdk/platforms/android-20\android.jar" -F bin/resources.ap_ --extra-packages com.google.android.gms -S "C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res"

stderr[
res\values\maps_attrs.xml:5: error: Attribute "mapType" has already been defined
res\values\maps_attrs.xml:12: error: Attribute "cameraBearing" has already been defined
res\values\maps_attrs.xml:13: error: Attribute "cameraTargetLat" has already been defined
res\values\maps_attrs.xml:14: error: Attribute "cameraTargetLng" has already been defined
res\values\maps_attrs.xml:15: error: Attribute "cameraTilt" has already been defined
res\values\maps_attrs.xml:16: error: Attribute "cameraZoom" has already been defined
res\values\maps_attrs.xml:17: error: Attribute "uiCompass" has already been defined
res\values\maps_attrs.xml:18: error: Attribute "uiRotateGestures" has already been defined
res\values\maps_attrs.xml:19: error: Attribute "uiScrollGestures" has already been defined
res\values\maps_attrs.xml:20: error: Attribute "uiTiltGestures" has already been defined
res\values\maps_attrs.xml:21: error: Attribute "uiZoomControls" has already been defined
res\values\maps_attrs.xml:22: error: Attribute "uiZoomGestures" has already been defined
res\values\maps_attrs.xml:23: error: Attribute "useViewLifecycle" has already been defined
res\values\maps_attrs.xml:24: error: Attribute "zOrderOnTop" has already been defined
]
stdout[
Configurations:
 (default)
 hdpi
 mdpi
 xhdpi
 xxhdpi
 af
 am
 ar
 be
 bg
 ca
 cs
 da
 de
 el
 en-GB
 en-IN
 es
 es-US
 et-EE
 fa
 fi
 fr
 fr-CA
 hi
 hr
 hu
 hy-AM
 in
 it
 iw
 ja
 ka-GE
 km-KH
 ko
 lo-LA
 lt
 lv
 mn-MN
 ms-MY
 nb
 nl
 pl
 pt
 pt-BR
 pt-PT
 ro
 ru
 sk
 sl
 sr
 sv
 sw
 th
 tl
 tr
 uk
 vi
 zh-CN
 zh-HK
 zh-TW
 zu

Files:
  color\common_signin_btn_text_dark.xml
    Src: () C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\color\common_signin_btn_text_dark.xml
  color\common_signin_btn_text_light.xml
    Src: () C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\color\common_signin_btn_text_light.xml
  color\wallet_primary_text_holo_light.xml
    Src: () C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\color\wallet_primary_text_holo_light.xml
  color\wallet_secondary_text_holo_dark.xml
    Src: () C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\color\wallet_secondary_text_holo_dark.xml
  drawable\common_signin_btn_icon_dark.xml
    Src: () C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable\common_signin_btn_icon_dark.xml
  drawable\common_signin_btn_icon_disabled_dark.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_disabled_dark.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_disabled_dark.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_disabled_dark.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_disabled_dark.9.png
  drawable\common_signin_btn_icon_disabled_focus_dark.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_disabled_focus_dark.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_disabled_focus_dark.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_disabled_focus_dark.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_disabled_focus_dark.9.png
  drawable\common_signin_btn_icon_disabled_focus_light.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_disabled_focus_light.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_disabled_focus_light.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_disabled_focus_light.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_disabled_focus_light.9.png
  drawable\common_signin_btn_icon_disabled_light.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_disabled_light.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_disabled_light.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_disabled_light.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_disabled_light.9.png
  drawable\common_signin_btn_icon_focus_dark.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_focus_dark.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_focus_dark.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_focus_dark.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_focus_dark.9.png
  drawable\common_signin_btn_icon_focus_light.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_focus_light.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_focus_light.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_focus_light.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_focus_light.9.png
  drawable\common_signin_btn_icon_light.xml
    Src: () C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable\common_signin_btn_icon_light.xml
  drawable\common_signin_btn_icon_normal_dark.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_normal_dark.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_normal_dark.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_normal_dark.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_normal_dark.9.png
  drawable\common_signin_btn_icon_normal_light.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_normal_light.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_normal_light.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_normal_light.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_normal_light.9.png
  drawable\common_signin_btn_icon_pressed_dark.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_pressed_dark.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_pressed_dark.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_pressed_dark.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_pressed_dark.9.png
  drawable\common_signin_btn_icon_pressed_light.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_icon_pressed_light.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_icon_pressed_light.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_icon_pressed_light.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_icon_pressed_light.9.png
  drawable\common_signin_btn_text_dark.xml
    Src: () C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable\common_signin_btn_text_dark.xml
  drawable\common_signin_btn_text_disabled_dark.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_text_disabled_dark.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_text_disabled_dark.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_text_disabled_dark.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_text_disabled_dark.9.png
  drawable\common_signin_btn_text_disabled_focus_dark.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_text_disabled_focus_dark.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_text_disabled_focus_dark.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_text_disabled_focus_dark.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_text_disabled_focus_dark.9.png
  drawable\common_signin_btn_text_disabled_focus_light.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_text_disabled_focus_light.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_text_disabled_focus_light.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_text_disabled_focus_light.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_text_disabled_focus_light.9.png
  drawable\common_signin_btn_text_disabled_light.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_text_disabled_light.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_text_disabled_light.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_text_disabled_light.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_text_disabled_light.9.png
  drawable\common_signin_btn_text_focus_dark.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_text_focus_dark.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_text_focus_dark.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_text_focus_dark.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_text_focus_dark.9.png
  drawable\common_signin_btn_text_focus_light.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_text_focus_light.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_signin_btn_text_focus_light.9.png
    Src: (xhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xhdpi\common_signin_btn_text_focus_light.9.png
    Src: (xxhdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-xxhdpi\common_signin_btn_text_focus_light.9.png
  drawable\common_signin_btn_text_light.xml
    Src: () C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable\common_signin_btn_text_light.xml
  drawable\common_signin_btn_text_normal_dark.9.png
    Src: (hdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-hdpi\common_signin_btn_text_normal_dark.9.png
    Src: (mdpi) C:\Users\bilek993\Documents\ReklamyTest\Temp\StagingArea\android-libraries\google-play-services_lib\res\drawable-mdpi\common_sig

我使用this插件作为广告,this作为游戏服务。提前谢谢。

2 个答案:

答案 0 :(得分:0)

您提到的上述资源已经过时了。而现在谷歌已经在Unity游戏引擎上正式支持AdMob。

在此处获取官方插件 - https://github.com/googleads/googleads-mobile-plugins/blob/master/README.md

- 导入整个包裹。修改androidmanifest.xml以包含权限和活动名称。

- 将位于sdk的/ extras / google / google_play_services / libproject的google-play-services_lib文件夹添加到项目的Plugins / Android文件夹中。

  • 要包含在C#脚本中的基本横幅代码: -
  

使用GoogleMobileAds.Api;

     

//在屏幕顶部创建一个320x50横幅。

     

BannerView bannerView =新的BannerView(" YOUR_AD_UNIT_ID",AdSize.Banner,AdPosition.Top);

     

//创建一个空的广告请求。

     

AdRequest request = new AdRequest.Builder()。Build();

     

//使用请求加载横幅。

     

bannerView.LoadAd(请求);

并且您可以在关联特定脚本的关卡上看到广告。

答案 1 :(得分:0)

您提到的上述资源已经过时了。 Unity游戏引擎有一个新的admob插件。

在此处获取新插件 - https://github.com/unity-plugins/Unity-Admob

- 导入整个包裹。修改androidmanifest.xml以包含权限和活动名称。

这就是你需要做的一切