質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
AdMob

AdMobは、事前に指定した条件に従ってアプリに広告を表示するGoogleのサービス。開発者の向けのサービスで、広告を掲載することにより、収益を得ることが可能です。その他、見た目や雰囲気などアプリに合う広告に変更したり、広告表示の場所を指定することもできます。

C#

C#はマルチパラダイムプログラミング言語の1つで、命令形・宣言型・関数型・ジェネリック型・コンポーネント指向・オブジェクティブ指向のプログラミング開発すべてに対応しています。

Unity3D

Unity3Dは、ゲームや対話式の3Dアプリケーション、トレーニングシュミレーション、そして医学的・建築学的な技術を可視化する、商業用の開発プラットフォームです。

Unity

Unityは、Unity Technologiesが開発・販売している、IDEを内蔵するゲームエンジンです。主にC#を用いたプログラミングでコンテンツの開発が可能です。

Q&A

2回答

522閲覧

【Unity x Admob】Androidにバナー広告が表示されない

_Beginner

総合スコア103

AdMob

AdMobは、事前に指定した条件に従ってアプリに広告を表示するGoogleのサービス。開発者の向けのサービスで、広告を掲載することにより、収益を得ることが可能です。その他、見た目や雰囲気などアプリに合う広告に変更したり、広告表示の場所を指定することもできます。

C#

C#はマルチパラダイムプログラミング言語の1つで、命令形・宣言型・関数型・ジェネリック型・コンポーネント指向・オブジェクティブ指向のプログラミング開発すべてに対応しています。

Unity3D

Unity3Dは、ゲームや対話式の3Dアプリケーション、トレーニングシュミレーション、そして医学的・建築学的な技術を可視化する、商業用の開発プラットフォームです。

Unity

Unityは、Unity Technologiesが開発・販売している、IDEを内蔵するゲームエンジンです。主にC#を用いたプログラミングでコンテンツの開発が可能です。

0グッド

0クリップ

投稿2018/10/14 06:25

編集2018/10/14 07:07

C#

1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5using GoogleMobileAds.Api; 6 7public class AdMob : MonoBehaviour { 8 9 void Start () { 10 string appId = "ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx"; 11 MobileAds.Initialize(appId); 12 RequestBanner(); 13 } 14 15 private void RequestBanner(){ 16 string adUnitId = "ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx"; 17 BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top); 18 AdRequest request = new AdRequest.Builder().Build(); 19 bannerView.LoadAd(request); 20 bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom); 21 } 22}

これを一番最初に読み込むシーンの空のオブジェクトにアタッチさせました。
appIdadUnitIDはしっかり記入しました。
しかし、広告が表示されません。
UnityのConsoleウィンドウでもエラーがでません。
テストIDでも表示されません・・・

どこがダメなのでしょうか。コードの不良であるならば、訂正してほしいです。
お願いします。

それとも寝て待ってればAdMobの処理が勝手に終わる感じでしょうか?

Unity2018.1.2f1 Personal

こちらのサイトを参考にさせていただきました。

下記コンソールに表示されるメッセージ↓

Starting auto-resolution before scene build...

UnityEngine.Debug:Log(Object)
Google.Logger:Log(String, LogLevel)
GooglePlayServices.PlayServicesResolver:Log(String, LogLevel)
GooglePlayServices.PlayServicesResolver:OnPostProcessScene()
UnityEditor.Build.BuildPipelineInterfaces:OnSceneProcess(Scene, BuildReport)


Dummy .ctor

UnityEngine.Debug:Log(Object)
GoogleMobileAds.Common.DummyClient:.ctor() (at Assets/GoogleMobileAds/Common/DummyClient.cs:28)
GoogleMobileAds.GoogleMobileAdsClientFactory:MobileAdsInstance() (at Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs:87)
System.Reflection.MethodBase:Invoke(Object, Object[])
GoogleMobileAds.Api.MobileAds:GetMobileAdsClient() (at Assets/GoogleMobileAds/Api/MobileAds.cs:54)
GoogleMobileAds.Api.MobileAds:.cctor() (at Assets/GoogleMobileAds/Api/MobileAds.cs:24)
AdMob:Start() (at Assets/Scripts/AdMob.cs:15)
AdMob:Start() (at Assets/Scripts/AdMob.cs:13)


Dummy Initialize

UnityEngine.Debug:Log(Object)
GoogleMobileAds.Common.DummyClient:Initialize(String) (at Assets/GoogleMobileAds/Common/DummyClient.cs:70)
GoogleMobileAds.Api.MobileAds:Initialize(String) (at Assets/GoogleMobileAds/Api/MobileAds.cs:28)
AdMob:Start() (at Assets/Scripts/AdMob.cs:13)


Dummy .ctor

UnityEngine.Debug:Log(Object)
GoogleMobileAds.Common.DummyClient:.ctor() (at Assets/GoogleMobileAds/Common/DummyClient.cs:28)
GoogleMobileAds.GoogleMobileAdsClientFactory:BuildBannerClient() (at Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs:27)
System.Reflection.MethodBase:Invoke(Object, Object[])
GoogleMobileAds.Api.BannerView:.ctor(String, AdSize, AdPosition) (at Assets/GoogleMobileAds/Api/BannerView.cs:34)
AdMob:RequestBanner() (at Assets/Scripts/AdMob.cs:20)
AdMob:Start() (at Assets/Scripts/AdMob.cs:14)


Dummy CreateBannerView

UnityEngine.Debug:Log(Object)
GoogleMobileAds.Common.DummyClient:CreateBannerView(String, AdSize, AdPosition) (at Assets/GoogleMobileAds/Common/DummyClient.cs:90)
GoogleMobileAds.Api.BannerView:.ctor(String, AdSize, AdPosition) (at Assets/GoogleMobileAds/Api/BannerView.cs:35)
AdMob:RequestBanner() (at Assets/Scripts/AdMob.cs:20)
AdMob:Start() (at Assets/Scripts/AdMob.cs:14)


Dummy LoadAd

UnityEngine.Debug:Log(Object)
GoogleMobileAds.Common.DummyClient:LoadAd(AdRequest) (at Assets/GoogleMobileAds/Common/DummyClient.cs:100)
GoogleMobileAds.Api.BannerView:LoadAd(AdRequest) (at Assets/GoogleMobileAds/Api/BannerView.cs:68)
AdMob:RequestBanner() (at Assets/Scripts/AdMob.cs:22)
AdMob:Start() (at Assets/Scripts/AdMob.cs:14)


Dummy .ctor

UnityEngine.Debug:Log(Object)
GoogleMobileAds.Common.DummyClient:.ctor() (at Assets/GoogleMobileAds/Common/DummyClient.cs:28)
GoogleMobileAds.GoogleMobileAdsClientFactory:BuildBannerClient() (at Assets/GoogleMobileAds/Platforms/GoogleMobileAdsClientFactory.cs:27)
System.Reflection.MethodBase:Invoke(Object, Object[])
GoogleMobileAds.Api.BannerView:.ctor(String, AdSize, AdPosition) (at Assets/GoogleMobileAds/Api/BannerView.cs:34)
AdMob:RequestBanner() (at Assets/Scripts/AdMob.cs:23)
AdMob:Start() (at Assets/Scripts/AdMob.cs:14)


Dummy CreateBannerView

UnityEngine.Debug:Log(Object)
GoogleMobileAds.Common.DummyClient:CreateBannerView(String, AdSize, AdPosition) (at Assets/GoogleMobileAds/Common/DummyClient.cs:90)
GoogleMobileAds.Api.BannerView:.ctor(String, AdSize, AdPosition) (at Assets/GoogleMobileAds/Api/BannerView.cs:35)
AdMob:RequestBanner() (at Assets/Scripts/AdMob.cs:23)
AdMob:Start() (at Assets/Scripts/AdMob.cs:14)

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

aja

2018/10/14 06:59 編集

これはテストIDでも広告が出ていないのでしょうか、それとUnityとAndroidのバージョンも重要です
_Beginner

2018/10/14 07:15

訂正しておきました。Unity2018.1.2f1です。テストIDでもできません。もしかしてそもそもエディターでは表示されないのでしょうか?
guest

回答2

0

もしiOSの方で広告が表示されているのであれば、コードレベルではなくAndroid固有の設定に問題がありそうです。
その場合は、Assets > Play Services Resolver > Android Resolver > Force Resolveを試して頂くと解決するかもしれません。
iOSでも表示されない場合は、一旦AdMob関連のPluginなどを削除し、もう一度マニュアルに沿って導入してみた方が原因を特定するより早く解決できるのではないかと思います。

投稿2018/10/30 06:41

yu_fur

総合スコア16

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

_Beginner

2018/10/30 11:53

回答有り難うございます。 IOSで試したことはないのですが、Android Resolverはやりました。 もう一度やり直してみます。
guest

0

もしかしてそもそもエディターでは表示されないのでしょうか?

参考にされたところの先に
リンク内容

Androidを接続してビルド、実行をします。

とあります。

androidのapkを出力し実機にインストールしてテストするか
Android Studioのエミュレータでテストしないと確認できません

投稿2018/10/14 08:30

aja

総合スコア3733

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問