Admob Memory Leak - avoiding by using empty activity

后端 未结 3 920
眼角桃花
眼角桃花 2020-12-23 02:38

Our app is getting hit pretty hard by a memory leak. I\'ve found that the root cause is the AdMob AdView keeping references to old activities. The problem is pretty well d

3条回答
  •  庸人自扰
    2020-12-23 03:10

    I am using "play-services-ads:7.5.0" and it was not necesary to create de AdMobActivity. It worked by:

    • Creating adView dinamically

      mAdView = new AdView(getApplicationContext(), AdSize.BANNER, banner_ad_unit_id); mAdsContainer.addView(mAdView);

    • Removing all views from linearLayout on destroy and destroying adView

                  mAdView.setAdListener(null);
                  mAdsContainer.removeAllViews();
                  mAdView.destroy();
      

    Unfortunatelly Interstitial still leaks

提交回复
热议问题