RE: [google-admob-ads-sdk] collapsible banner ads cause memory leaks.

965 views
Skip to first unread message
Message has been deleted

Mobile Ads SDK Forum Advisor

unread,
Dec 11, 2023, 1:00:16 AM12/11/23
to thisisg...@gmail.com, google-adm...@googlegroups.com

Hi Gouranga,

Thank you for contacting the Mobile Ads SDK Support team.

After I reviewed your concern, I understand that you have memory leaks in your application for collapsible banner ads

1. Please refer to the sample application for the implementation and guide for collapsible banner ads. When implementing ads in your application, it is very important to follow AdMob Policies, as well as Implementation Guidelines to avoid any issues.  Kindly double-check your implementation so that Ads load and show as expected. You may refer to Banner Implementation Guidelines, as well as the Recommended and Disallowed implementation guidance for further reference.

If the issue still persists, then please provide the following information privately for further investigation:

  • app ID
  • ad unit ID
  • Charles proxy logs
  • SDK Version being used
  • Video recording of the issue
  • Sample project reproducing the issue

2. Yes, there is a potential for policy issues when an App-Open ad appears on top of an expanded popup window containing a collapsible banner, especially if it is not implemented correctly. Here's why:

Policy Violations:

  • Disruptive Ads: Google's AdMob policies prohibit ads that are disruptive to the user experience. An App-Open ad appearing on top of another ad unit can be disruptive and make it difficult for users to interact with the app's content.
  • Oversaturation: Showing multiple ads simultaneously can create an over-saturated experience for users and violate the policy against excessive ad volume.
  • Accidental Clicks: Users might accidentally click the App-Open ad when trying to interact with the underlying content, leading to misleading clicks and user frustration.

You can provide the following details via reply privately to the author option or directly provide it to the link below.

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

1. Navigate to

https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=Mobile+Ads+SDK&entry.460850823=5004Q00002qXhCoQAK&entry.80707362=00214696

2. Fill out all fields, and attach your file(s).

3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link.

This message is in relation to case "ref:!00D1U01174p.!5004Q02qXhCo:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team


Gouranga Das

unread,
Dec 11, 2023, 9:24:47 AM12/11/23
to Google Mobile Ads SDK Developers
I have uploaded sample project. Please check it.

Shimin

unread,
Feb 5, 2024, 12:05:06 PM2/5/24
to Google Mobile Ads SDK Developers

To reproduce the memory leak.

Open the app.
Let the collapsible banner ad load and it will show as expanded view.
Do NOT collapse the banner ad. Now kill the app from recent apps.
Observe the logcat in android studio, it will have the following error logs.

android.view.WindowLeaked: Activity MainActivity has leaked window android.widget.PopupWindow$PopupDecorView that was originally added here
                                                                                                    at android.view.ViewRootImpl.<init>(ViewRootImpl.java:1009)
                                                                                                    at android.view.ViewRootImpl.<init>(ViewRootImpl.java:997)
                                                                                                    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:397)
                                                                                                    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:150)
                                                                                                    at android.widget.PopupWindow.invokePopup(PopupWindow.java:1580)
                                                                                                    at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1346)
                                                                                                    at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1312)
                                                                                                    at com.google.android.gms.internal.ads.zzbsm.zzb(com.google.android.gms:play-services-ads@@22.6.0:86)
                                                                                                    at com.google.android.gms.internal.ads.zzbkj.zza(com.google.android.gms:play-services-ads@@22.6.0:15)
                                                                                                    at com.google.android.gms.internal.ads.zzchc.zzP(com.google.android.gms:play-services-ads@@22.6.0:6)
                                                                                                    at com.google.android.gms.internal.ads.zzchc.zzj(com.google.android.gms:play-services-ads@@22.6.0:16)
                                                                                                    at com.google.android.gms.internal.ads.zzchv.zza(com.google.android.gms:play-services-ads@@22.6.0:3)
                                                                                                    at com.google.android.gms.internal.ads.zzcht.run(Unknown Source:4)
                                                                                                    at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                    at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    at com.google.android.gms.internal.ads.zzfqv.zza(com.google.android.gms:play-services-ads-lite@@22.6.0:1)
                                                                                                    at com.google.android.gms.ads.internal.util.zzf.zza(com.google.android.gms:play-services-ads@@22.6.0:1)
                                                                                                    at com.google.android.gms.internal.ads.zzfqv.dispatchMessage(com.google.android.gms:play-services-ads-lite@@22.6.0:1)
                                                                                                    at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    at android.os.Looper.loop(Looper.java:294)
                                                                                                    at android.app.ActivityThread.main(ActivityThread.java:8177)
                                                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Rana

unread,
Mar 20, 2024, 4:57:34 AM3/20/24
to Google Mobile Ads SDK Developers
Do you get any solution? I'm also getting the same problem.

Mobile Ads SDK Forum Advisor

unread,
Mar 21, 2024, 7:38:20 PM3/21/24
to masud....@gmail.com, google-adm...@googlegroups.com
Hello Rana,

Thanks for bumping up the thread.

Would you be able to reproduce the issue in our Banner example as well?

If you do, can you provide the following details?
  • Steps to reproduce
  • Stack trace
  • Screenshot(s) or recording(s) captured in memory profiler that show memory leak

Regards,
Joshua

ref:!00D1U01174p.!5004Q02qXhCo:ref

alex...@gmail.com

unread,
May 28, 2024, 1:23:44 PM5/28/24
to Google Mobile Ads SDK Developers
Issue still happening on: com.google.android.gms:play-services-ads:23.1.0

Using collapsible banner

android.view.WindowLeaked: Activity com.example.activity.CallActivity has leaked window android.widget.PopupWindow$PopupDecorView{99076dd V.E...... R......D 0,0-719,763} that was originally added here
                  at android.view.ViewRootImpl.<init>(ViewRootImpl.java:765)
                  at android.view.ViewRootImpl.<init>(ViewRootImpl.java:749)
                  at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:431)
                  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:109)
                  at android.widget.PopupWindow.invokePopup(PopupWindow.java:1576)
                  at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1342)
                  at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1308)
                  at com.google.android.gms.ads.internal.gmsg.ar.a(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:1383)
                  at com.google.android.gms.ads.internal.webview.r.x(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:52)
                  at com.google.android.gms.ads.internal.webview.r.e(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:100)
                  at com.google.android.gms.ads.internal.webview.al.run(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:25)
                  at android.os.Handler.handleCallback(Handler.java:938)
                  at android.os.Handler.dispatchMessage(Handler.java:99)
                  at m.azn.a(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:1)
                  at com.google.android.gms.ads.internal.util.f.a(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:2)
                  at m.azn.dispatchMessage(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:1)
                  at android.os.Looper.loop(Looper.java:250)
                  at android.app.ActivityThread.main(ActivityThread.java:7851)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)



suchat

unread,
May 29, 2024, 3:17:26 AM5/29/24
to alex...@gmail.com, google-adm...@googlegroups.com

ไม่เข้าใจเลย อัพโหลดไฟล์จากไหน??


ในวันที่ พ. 29 พ.ค. 2024 00:24 alex...@gmail.com <alex...@gmail.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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/39756201-d091-4139-9798-4a3875e63564n%40googlegroups.com.

Mobile Ads SDK Forum Advisor

unread,
May 29, 2024, 1:25:32 PM5/29/24
to alex...@gmail.com, google-adm...@googlegroups.com
Hello Alex,

Thanks for the information.


Would you be able to reproduce the issue in our Banner example as well?

If you do, can you provide the following?
  • Steps to reproduce
  • Full stack trace
  • Screenshot(s) or recording(s) captured in memory profiler that show memory leak
    If not, can you provide the following?
    • Your sample project
    • Steps to reproduce
    • Full stack trace
    • Screenshot(s) or recording(s) captured in memory profiler that show memory leak
       
      This message is in relation to case "ref:!00D1U01174p.!5004Q02qXhCo:ref" (ADR-00214696)

      Thanks,
       
      Google Logo
      Joshua Hui
      Mobile Ads SDK Team


      alex...@gmail.com

      unread,
      Jun 6, 2024, 11:09:11 AM6/6/24
      to Google Mobile Ads SDK Developers
      Ok new findings, it only happens when the banner is expanded, if banner is collapsed no memory leak error is shown.

      It reproduces with the 
      Banner example as well..

      Steps to reproduce: Start the app, when the banner shows in expanded mode, press back button on device to end Activity

      Banner example with added extras:
      private void loadBanner() {
      // Create a new ad view.
      adView = new AdView(this);
      adView.setAdUnitId(AD_UNIT_ID);
      adView.setAdSize(getAdSize());

      // Replace ad container with new ad view.
      adContainerView.removeAllViews();
      adContainerView.addView(adView);

      Bundle extras = new Bundle();
      extras.putString("collapsible", "bottom");
      extras.putString("collapsible_request_id", UUID.randomUUID().toString());
      // Start loading the ad in the background.

      AdRequest adRequest = new AdRequest.Builder()
      .addNetworkExtrasBundle(AdMobAdapter.class, extras)
      .build();
      adView.loadAd(adRequest);
      }


      banner_expanded.png 

      If Activity is Destroyed while banner is expanded, this will show on Logcat:

      android.view.WindowLeaked: Activity com.google.android.gms.example.bannerexample.MyActivity has leaked window android.widget.PopupWindow$PopupDecorView{612b570 V.E...... R......D 0,0-719,763} that was originally added here (Ask Gemini)

                        at android.view.ViewRootImpl.<init>(ViewRootImpl.java:765)
                        at android.view.ViewRootImpl.<init>(ViewRootImpl.java:749)
                        at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:431)
                        at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:109)
                        at android.widget.PopupWindow.invokePopup(PopupWindow.java:1576)
                        at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1342)
                        at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1308)
                        at com.google.android.gms.ads.internal.gmsg.ar.a(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:1383)
                        at com.google.android.gms.ads.internal.webview.r.x(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:52)
                        at com.google.android.gms.ads.internal.webview.r.e(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:100)
                        at com.google.android.gms.ads.internal.webview.al.run(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:25)
                        at android.os.Handler.handleCallback(Handler.java:938)
                        at android.os.Handler.dispatchMessage(Handler.java:99)
                        at m.azn.a(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:1)
                        at com.google.android.gms.ads.internal.util.f.a(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:2)
                        at m.azn.dispatchMessage(:com.google.android.gms.policy_ads_fdr_dynamite@241199803@241199801034.618989241.618989241:1)
                        at android.os.Looper.loop(Looper.java:250)
                        at android.app.ActivityThread.main(ActivityThread.java:7851)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)

      david.sc...@gmail.com

      unread,
      Aug 29, 2025, 6:41:08 AM (7 days ago) Aug 29
      to Google Mobile Ads SDK Developers
      com.google.android.gms:play-services-ads:24.5.0

      still happens

      android.view.WindowLeaked: Activity x.y.z has leaked window android.widget.PopupWindow$PopupDecorView{38c51ce V.E...... R......D 0,0-1078,1212} that was originally added here (Ask Gemini)
          at android.view.ViewRootImpl.<init>(ViewRootImpl.java:1269)
          at android.view.ViewRootImpl.<init>(ViewRootImpl.java:1256)
          at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:476)
          at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:158)

          at android.widget.PopupWindow.invokePopup(PopupWindow.java:1580)
          at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1346)
          at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1312)
          at com.google.android.gms.internal.ads.zzbso.zzc(com.google.android.gms:play-services-ads@@24.5.0:83)
          at com.google.android.gms.internal.ads.zzbkm.zza(com.google.android.gms:play-services-ads@@24.5.0:16)
          at com.google.android.gms.internal.ads.zzcfo.zzaa(com.google.android.gms:play-services-ads@@24.5.0:6)
          at com.google.android.gms.internal.ads.zzcfo.zzn(com.google.android.gms:play-services-ads@@24.5.0:17)
          at com.google.android.gms.internal.ads.zzcgm.zza(com.google.android.gms:play-services-ads@@24.5.0:4)
          at com.google.android.gms.internal.ads.zzcgk.run(Unknown Source:4)
          at android.os.Handler.handleCallback(Handler.java:995)
          at android.os.Handler.dispatchMessage(Handler.java:103)
          at com.google.android.gms.internal.ads.zzfrw.zza(com.google.android.gms:play-services-ads-api@@24.5.0:1)
          at com.google.android.gms.ads.internal.util.zzf.zza(com.google.android.gms:play-services-ads@@24.5.0:1)
          at com.google.android.gms.internal.ads.zzfrw.dispatchMessage(com.google.android.gms:play-services-ads-api@@24.5.0:1)
          at android.os.Looper.loopOnce(Looper.java:248)
          at android.os.Looper.loop(Looper.java:338)
          at android.app.ActivityThread.main(ActivityThread.java:9067)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)

      Mobile Ads SDK Forum Advisor

      unread,
      Sep 3, 2025, 11:48:45 AM (2 days ago) Sep 3
      to david.sc...@gmail.com, google-adm...@googlegroups.com
      Hello David,

      Thanks for letting us know.
       

      To help us investigate, could you please provide the following?

      • Steps to reproduce
      • A sample project
      • A full stack trace from all threads​​​​​​​

      If not, is the issue not reproducible on your end?

      Please feel free to reply privately.

       

      Thanks,
       
      Google Logo
      Joshua
      Mobile Ads SDK Team


      Feedback
      How was our support today?

      rating1    rating2    rating3    rating4    rating5
      [2025-09-03 15:47:35Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02qXhCo:ref" (ADR-00214696)



      Reply all
      Reply to author
      Forward
      0 new messages