Admob SDK is extremely slow and blocking the UI thread

1,427 views
Skip to first unread message

Russell Wilson

unread,
Aug 5, 2018, 5:30:04 AM8/5/18
to Google Mobile Ads SDK Developers
My app displays admob smart banners and I have a wrapped a firebase performance trace around the adView.loadAd() method.

MobileAds.initialize() has already been invoked before this method (which itself is quite slow).

The results for 1.1 million samples are in the attached screenshot.

Median: 436ms
95% percentile: 1520ms

Is this normal?  This method is locking up the UI thread for ridiculous amounts of time!

We are being punished by Google for slow startup, slow rendering and ANRs these days, but the worst culprit seems to be this SDK!

Is this acceptable?  What am I doing wrong?  What can I do to improve this?
Screen Shot 2018-08-05 at 10.00.09.png

mobileadssdk-a...@google.com

unread,
Aug 6, 2018, 4:02:04 AM8/6/18
to Russell Wilson, Google Mobile Ads SDK Developers
Hi there,

Thanks for contacting us. We will look into this and get back to you for any feedback.

Regards,
Steven Balan
Mobile Ads SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/97084a7c-d468-4dba-93e5-93ec1572dfb9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mobileadssdk-a...@google.com

unread,
Aug 7, 2018, 5:47:41 AM8/7/18
to google-adm...@googlegroups.com, russell.h...@gmail.com
Hi Russell,

Thanks for your patience.

I also wrapped the adView.loadAd() method with the Firebase Performance Trace in order to test the performance of the method on my end. The result is different from what you've captured (refer to the attached screenshot), the adView.loadAd() method only took 125 ms which seems to be fine and normal.

With that said, could you try this modified BannerExample app and see if you will encounter the same Performance Monitoring Results? Also, if possible, could you share to us privately (using Reply privately to author option) a copy of your app where the performance issue is noticeable?

Regards,
Steven Balan
Mobile Ads SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

On 08/05/18 17:30:04 russell.h...@gmail.com wrote:
--
Screen+Shot+2018-08-07+at+4.03.41+PM.png

Russell Wilson

unread,
Aug 7, 2018, 6:12:53 AM8/7/18
to Google Mobile Ads SDK Developers
Hi Steve,

Thanks for looking into this.  When you say a "copy of your app" are you after an APK or source?

I note your BannerExample is using adSize="BANNER", while my app uses adSize="SMART_BANNER".  Would this result in any difference?

What is happening under the hood on that adView.loadAd() method, is it blocking while a round trip network request is being made?

Cheers,

Russell

mobileadssdk-a...@google.com

unread,
Oct 4, 2018, 2:31:15 AM10/4/18
to Russell Wilson, Google Mobile Ads SDK Developers
Hi Russell,

I just want to check if you still consistently encounters any noticeable lags in your app when loading ads via the Mobile Ads SDK. Also, were you able to check the points we've raised to you in the private thread last time?

Regards,
Ivan Bautista
Mobile Ads SDK Team




To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsubscrib...@googlegroups.com.

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

Régis

unread,
Nov 16, 2018, 11:39:34 AM11/16/18
to Google Mobile Ads SDK Developers
Same problem here. Did you find a solution to avoid this lag ? Thanks a lot.

mobileadssdk-a...@google.com

unread,
Nov 18, 2018, 11:31:56 PM11/18/18
to Régis, Google Mobile Ads SDK Developers
Hi everyone, 

As per Release Notes, starting 17.0.0, there's a new required implementation for initializing the SDK. It is no longer programmatically initialized using the MobileAds.initialize() method, but instead, you have to specify your AdMob App ID in your app's AndroidManifest.xml as seen in this guide.

That said, is it possible for you to try the new implementation using SDK version 17.0.0 or the latest version and see if you still encounter any lags?

Regards,
Ivan Bautista
Mobile Ads SDK Team


On 11/17/18 00:39:34 regis...@audioguidia.com wrote:
Same problem here. Did you find a solution to avoid this lag ? Thanks a lot.

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

Régis

unread,
Nov 19, 2018, 3:57:55 AM11/19/18
to Google Mobile Ads SDK Developers
Thanks for your answer. Nevertheless, I don't see in the release notes of v 17.0.0 that it is no longer required to use MobileAds.initialize()

Moreover, the official guide you mention still mentions the fact that we have to use MobileAds.initialize()

Lest question : if it is more necessary to initialize the SDK with MobileAds.initialize(), how do I manage the GDPR ? Indeed, until now, I initialized the SDK only once the user accepted my privacy policy at startup. In other words, does the manifest initialization send some private information to Google ? 

Thanks.

mobileadssdk-a...@google.com

unread,
Nov 20, 2018, 1:08:58 AM11/20/18
to Régis, Google Mobile Ads SDK Developers
Hi Régis,

Apologies for the confusion, but in addition to declaring the AdMob App Id in your manifest file, you still need to call MobileAds.initialize() to initialize the SDK.

That said, do you still encounter any lags when using the new implementation with our latest SDK?

On the other hand, I believe that initialization of the SDK mainly just initializes the SDK for the purpose of reducing latency once the first Ad Request is sent via loadAd() method. However, I will also double check this with the team and we will get back to you with our insights.

Regards,
Ivan Bautista
Mobile Ads SDK Team
--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

Sergio

unread,
Jun 30, 2020, 7:55:08 AM6/30/20
to Google Mobile Ads SDK Developers
Hello,

Sorry for reviving this thread. But I'm suffering slow app startup because of AdView.loadAd method. I tried calling MobileAds.initialize, and not calling it. But it's the same. As I read here, if I don't call initialize it's automatically called when the first request is made: https://developers.google.com/android/reference/com/google/android/gms/ads/MobileAds#initialize(android.content.Context,%20com.google.android.gms.ads.initialization.OnInitializationCompleteListener)

Is there any way to avoid the lag that loadAd produces? Any way of doing it in a background thread?

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 30, 2020, 12:18:57 PM6/30/20
to djpe...@gmail.com, google-adm...@googlegroups.com
Hi Sergio,

Thank you for bringing this question to our attention.

Can you share via "Reply privately to author" button with some more information about this issue.
  • App Id and Ad Unit Id
  • Sample app showing the implementation
  • Any error codes or charles logs
  • Any stacktraces or logs showing the slowing down of the app
  • Do you remember the original thread that you had started so we can go back and look at it for reference.
  • Any reproducible steps that you have seen that slow the app down more then normal
Also for your privacy when sending the above information we ask that you never post it online.

Regards,
William Pescherine
Mobile Ads SDK Team

ref:_00D1U1174p._5004Q21ATOi:ref
Reply all
Reply to author
Forward
0 new messages