Unity Admob banners not showing anymore

630 views
Skip to first unread message

Jan de Lange

unread,
Dec 5, 2017, 2:33:50 PM12/5/17
to Google Mobile Ads SDK Developers

I had Admob working, then I installed the Google Play plugin and then I could not get Admob working again. All compiles and builds onto the Android device, but no ads are shown. Trying to resolve the issue, I did following:

  1. Upgrade to VS2017
  2. Upgrade to Unity 2017.2.0f3
  3. Updated Android Studio: SDK tools 26.1.1, SDK platform tools 26.0.2
  4. Downloaded and re-imported mobile Ads unity package to V3.9.0
  5. Rebuilt and loaded following sample application Get started

public class AdManager : MonoBehaviour {

   
private BannerView bannerView;

   
// Use this for initialization
   
void Start ()
   
{
#if UNITY_ANDROID
       
string appId = " my appId here ";
#else
       
string appId = "unexpected_platform";
#endif
       
// Initialize the Google Mobile Ads SDK.
       
MobileAds.Initialize(appId);

       
this.RequestBanner();
   
}

   
private void RequestBanner()
   
{
#if UNITY_ANDROID        
       
string sampleAdUnitId = "ca-app-pub-3940256099942544/6300978111";
#else
       
string sampleAdUnitId = "unexpected_platform";
#endif

       
// Create a 320x50 banner at the top of the screen.
        bannerView
= new BannerView(sampleAdUnitId, AdSize.Banner, AdPosition.Top);

       
// Create an empty ad request.
       
AdRequest request = new AdRequest.Builder().Build();

       
// Load the banner with the request.
        bannerView
.LoadAd(request);
   
}
}

Attached is a dump of the Logcat taken with Android Studio from my Samsung phone, Verbose, sorted on keyword "Ads". This is my first time Logcat, so if something is missing, let me know.

Why are my ads not shown? Thanks, Jan
Admob test logcat dump 5-12.txt

Bharani Cherukuri (Mobile Ads SDK Team)

unread,
Dec 5, 2017, 5:56:48 PM12/5/17
to Google Mobile Ads SDK Developers
Hello Jan, 

Based on the logs, it looks like you're receiving an Error Code:2 which indicates that the ad request was unsuccessful due to a network connectivity issue. Can you make sure to try the request again with proper network connection and let me know if you're having a difficulty loading the ads? If you continue to have an issue with this, do provide us the Charles logs with SSL Proxy enabled, so I can take a look? 

Regards,
Bharani Cherukuri
Mobile Ads SDK Team

Jan de Lange

unread,
Dec 6, 2017, 1:09:11 PM12/6/17
to Google Mobile Ads SDK Developers

Hello Bharani, thanks for trying to help me out. Really appreciated! Your feedback is pointing to an issue with my Android phone, not the Unity script or code. So I decided to install an Android emulator (I chose Leapdroid as I need something simple on this old laptop) to see if ads will show on this, and indeed they do! See image attached.

So there is something messed up in the communication on my Samsung Galaxy S2. My first guess its the Google Play Games install, as after that install, ads stopped showing. I did uninstall it, restarted the phone, but this has not sovled the ad problem. Invoking any Google Play Games / Services functions (e.g. leaderboard) caused the game to crash. Even invoking them with using.GooglePlayGames; and using UnityEngine.SocialPlatforms; was sufficient to crash the program. Not sure why and not sure how to get my phone in the state befor this install.

I would appreciate any further help but I do realize it's not Admob, it's something else that is causing the problem.

Jan

Note: I would not know how to put the Charles logs between Android Studio and the USB-attached phone.

Bharani Cherukuri (Mobile Ads SDK Team)

unread,
Dec 6, 2017, 5:41:00 PM12/6/17
to Google Mobile Ads SDK Developers
Hello Jan, 

I'm glad that you figured out the cause. As for your second concern, can you try changing the network on your test device to switch between Wifi and LTE, to see if the issue persists? Also, could you try testing your project on a different device to check if it is a device specific or a network related issue? Let me know how it goes.

Regards,
Bharani Cherukuri
Mobile Ads SDK Team

On Tuesday, December 5, 2017 at 2:33:50 PM UTC-5, Jan de Lange wrote:

Jan de Lange

unread,
Dec 8, 2017, 5:04:13 AM12/8/17
to Google Mobile Ads SDK Developers
Hello Bharani,

Thanks. The problem on my mobile phone persists on Wifi and Umts. However on my Samsung Note tablet the ads work fine. So it is definitely something with my phone. I will need to figure out what it is, but at least I can continue my development using Admob. Thanks for your help.

Regards, Jan
Reply all
Reply to author
Forward
0 new messages