しめ鯖日記

swift, iPhoneアプリ開発, ruby on rails等のTipsや入門記事書いてます

UnityにAdmob導入時に"Theme.IAPTheme"がないと言われた時の対処法

UnityにAdmobを入れようとしたのですがAndroid版ビルド時に下記エラーが出たので調査内容と対応方法をメモ。

エラー内容

内容は下の通りです。

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
/Applications/android-sdk-macosx/build-tools/23.0.0-preview/aapt package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "/Applications/android-sdk-macosx/platforms/android-22/android.jar" -F bin/resources.ap_ --extra-packages com.google.unity:com.Shimesaba.Block3D -S "[projectDir]/Temp/StagingArea/android-libraries/unity-android-resources/res"

stderr[
AndroidManifest.xml:16: error: Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.IAPTheme').

]
stdout[
Configurations:
 (default)

Files:
  values/version.xml
    Src: () [projectDir]/Temp/StagingArea/android-libraries/unity-android-resources/res/values/version.xml
  AndroidManifest.xml
    Src: () AndroidManifest.xml

Resource Dirs:
  Type values
    values/version.xml
      Src: () [projectDir]/Temp/StagingArea/android-libraries/unity-android-resources/res/values/version.xml
Including resources from package: /Applications/android-sdk-macosx/platforms/android-22/android.jar
applyFileOverlay for drawable
trying overlaySet Key=app_banner.png
trying overlaySet Key=app_icon.png
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for transition
applyFileOverlay for xml
applyFileOverlay for raw
applyFileOverlay for color
applyFileOverlay for menu
applyFileOverlay for mipmap
Processing image: res/drawable-xhdpi/app_banner.png
Processing image: res/drawable/app_icon.png
    (processed image res/drawable/app_icon.png: 94% size of source)
    (processed image res/drawable-xhdpi/app_banner.png: 93% size of source)
    (new resource id app_banner from xhdpi-v4/drawable/app_banner.png #generated)
    (new resource id app_icon from drawable/app_icon.png #generated)
]

つまずいたのは下の点、Theme.IAPThemeという値がないと言われています。

No resource found that matches the given name (at 'theme' with value '@style/Theme.IAPTheme')

原因

Assets/Plugins/Androidフォルダに[android sdk path]/extras/google/google_play_services/libproject/google-play-services_libフォルダ内のファイルを入れるべきだったのですが、間違えて[android sdk path]/extras/google/google_play_servicesを入れてた事が原因でした。
修正したらちゃんと動きました。

おまけ

少しこの辺りについて調べたのですがiapとは課金ライブラリの模様でした。
Admobでなぜ課金ライブラリが?」と思ったのですが、どうやらAdmobを使って自社アイテムの広告を出すという機能があるようです。