Test ads are not displayed
Hi Mobile Ads SDK Team.
I tried to display a test ad, but it returned an "Ad failed to load : 3" error and could not be displayed.
What is puzzling is that the App ID and Unit ID are using the sample provided by Admob.
I would like to know why I cannot display them. Thank you.
Describe your environmentUnity version: 2020.3.33f1
Google Mobile Ads Unity plugin version: 7.0.0
Platform: Android
Platform OS version: Android 11
Any specific devices issue occurs on: Tested on Pixel 3a
Mediation ad networks used, and their versions: NO
ID'sApp ID : ca-app-pub-3940256099942544~3347511713 (
Sample app ID)
Banner Unit ID : ca-app-pub-3940256099942544/6300978111 (
Test unit ID)
StackTrace04-30 12:04:18.891 17895 17925 I Ads : Updating ad debug logging enablement.
04-30 12:04:18.906 17895 17933 W Ads : Update ad debug logging enablement as false
04-30 12:04:19.349 17895 17925 I Unity : Requesting Banner ad.
04-30 12:04:19.349 17895 17925 I Unity : UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
04-30 12:04:19.349 17895 17925 I Unity : UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
04-30 12:04:19.349 17895 17925 I Unity : UnityEngine.Logger:Log (UnityEngine.LogType,object)
04-30 12:04:19.349 17895 17925 I Unity : UnityEngine.Debug:Log (object)
04-30 12:04:19.349 17895 17925 I Unity : AdmobScript:RequestBannerAd () (at /Users/xxx/Desktop/AdmobTest/Assets/AdmobTest/AdmobScript.cs:25)
04-30 12:04:19.349 17895 17925 I Unity : GoogleMobileAds.Common.MobileAdsEventExecutor:Update ()
04-30 12:04:19.467 17895 17895 I Ads : Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("xxx")) to get test ads on this device.
04-30 12:04:19.675 17895 18063 W Ads : Not retrying to fetch app settings
04-30 12:04:19.756 4572 18070 I Ads : SDK version: afma-sdk-a-v221310999.214106000.1
04-30 12:04:19.758 4572 18070 I Ads : HTTP timeout: 60000 milliseconds.
04-30 12:04:20.186 17895 17895 I Ads : Ad failed to load : 3
04-30 12:04:20.200 17895 18077 I Unity : Banner ad failed to load with error: No ad config.
04-30 12:04:20.200 17895 18077 I Unity : UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
04-30 12:04:20.200 17895 18077 I Unity : UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
04-30 12:04:20.200 17895 18077 I Unity : UnityEngine.Logger:Log (UnityEngine.LogType,object)
04-30 12:04:20.200 17895 18077 I Unity : UnityEngine.Debug:Log (object)
04-30 12:04:20.200 17895 18077 I Unity : AdmobScript:OnAdFailedToLoad (object,GoogleMobileAds.Api.AdFailedToLoadEventArgs) (at /Users/xxx/Desktop/AdmobTest/Assets/AdmobTest/AdmobScript.cs:57)
04-30 12:04:20.200 17895 18077 I Unity : GoogleMobileAds.Api.BannerView:<ConfigureBannerEvents>m__1 (object,GoogleMobileAds.Common.LoadAdErrorClientEventArgs)
04-30 12:04:20.200 17895 18077 I Unity : GoogleMobileAds.Android.BannerClient:onAdFailedToLoad (UnityEngine.AndroidJavaObject)
04-30 12:04:20.200 17895 18077 I Unity : System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
Test Code```c#
using UnityEngine;
using GoogleMobileAds.Api;
using GoogleMobileAds.Common;
public class AdmobScript : MonoBehaviour
{
BannerView bannerView;
public void Start()
{
MobileAds.Initialize(HandleInitCompleteAction);
}
void HandleInitCompleteAction(InitializationStatus initStatus)
{
MobileAdsEventExecutor.ExecuteInUpdate(RequestBannerAd);
}
#region BANNER ADS
void RequestBannerAd()
{
#if DEBUG
Debug.Log("Requesting Banner ad.");
#endif
// These ad units are configured to always serve test ads.
#if UNITY_EDITOR
string adUnitId = "unused";
#elif UNITY_ANDROID
string adUnitId = "ca-app-pub-3940256099942544/6300978111";
#elif UNITY_IPHONE
string adUnitId = "ca-app-pub-3940256099942544/2934735716";
#else
string adUnitId = "unexpected_platform";
#endif
// Clean up banner before reusing
if (bannerView != null)
{
bannerView.Destroy();
}
// Create a 320x50 banner at top of the screen
bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
bannerView.OnAdFailedToLoad += OnAdFailedToLoad;
// Load a banner ad
AdRequest request = new AdRequest.Builder().Build();
bannerView.LoadAd(request);
}
void OnAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
{
Debug.Log("Banner ad failed to load with error: "+args.LoadAdError.GetMessage());
}
#endregion
}
```
Referenced code