How to properly destory a PublisherAdView instance?

558 views
Skip to first unread message

Kotan

unread,
Jul 20, 2014, 11:00:45 AM7/20/14
to google-adm...@googlegroups.com
One of our advertisers has a banner (medium rectangle) implementing a swipe cube ad that automatically rotates every few seconds. It's Javascript code writes a lot of output to the console (using console.log). That output appears in the LogCat view of Eclipse. The problem is it keeps appearing there even after the banner has been closed and destroyed, indicating that the WebView continues to run.

I've gone at great length to ensure that the PublisherAdView is removed from the view hierarchy, that PublisherAdView.destroy() is called in every case and that the app doesn't retain any reference to the instance. Is there anything I'm missing? What's the proper way to destroy a PublisherAdView instance?

I'm afraid that there a further problems. PublisherAdView.pause() doesn't seem to properly work either. Even after it's called, the Javascript output continues as well. Wouldn't it need to stop the Javascript processing as well?

We are afraid that this is the cause of another problem with experience. If we let the device run for some time, all WebViews in our app stop to work (they remain blank) and the app becomes basically unusable as half of our activities are implemented with WebViews. These activities have served as well for two years until we added the Google Mobile Ads SDK.

There are many posts related to this topic, some of them quite old and none of them with a real solution. Are there any plans (with a date) to fix this problem?

P.S.: It seems to only affect Android, not iOS.

Amy Quispe (AdMob SDK Team)

unread,
Jul 25, 2014, 5:34:16 PM7/25/14
to google-adm...@googlegroups.com
Hi Kotan,

Sorry for taking a few days to get back to you.

Could you send me some code to reproduce this and the logs you're getting?

Amy Quispe

Kotan

unread,
Jul 28, 2014, 4:20:47 PM7/28/14
to google-adm...@googlegroups.com
Hi Amy

Thanks for coming back to this issue. It's a serious problem for us as we don't dare to deliver premium ad campaigns with advanced creatives (swipe ad cube) as long as the app becomes unstable. These creatives would pay the most money by far.

So I've created an Android project that is more or less minimal and demonstrates the problem.

The problem has two aspects:

The first one is that the Javascript code (and therefore the ad) continues to run even after it has been paused, destroyed, removed from the parent view and the reference to it set to null. It can be reproduced with the following steps:
  • Start the app
  • Wait (at most 5 seconds) until the ad appears (if you see "no fill from server" in the log, quit the app and try again)
  • Quit the app using the back button
Now you can see that the ad continues to write output to the log (LogCat) even though it has been deleted in MainActivity.onStop(). The log output looks like this:


We've observed the problem on Android 4.2 (using a Google Galaxy Nexus, which doesn't properly display the 3-dimensional part), Android 4.3 (using a Samsung Galaxy S3) and Android 4.4 (using a LG Google Nexus 5). And we've only observed it with advanced creatives that use Javascript for animations (possibly in combination with timers).

The second aspect is that after some time, all web views in the app stop to work. The only display a blank view. We think the second aspect is related to the Mobile Ads SDK as well as the app never showed such a problem before we added this ad SDK.

To reproduce it:
  • Start the app
  • Tap the "About" button to open the about activity
  • Go back to the main screen using the back button
  • Repeat the forth and back for about two minutes or about 20 times
  • After some time, the about screen, which is implemented using a web view, will remain blank.
The problem is usually accompanied by the following messages in the log:

07-28 21:49:38.021: E/chromium(10655): [ERROR:in_process_view_renderer.cc(189)] Failed to request GL process. Deadlock likely: 0

07-28 21:49:27.871: W/AwContents(10655): nativeOnDraw failed; clearing to background color.

The first message appears exactly two times. The second message appears about 10 times whenever the web view is shown.

We've observed this problem only on Android 4.4 (using the the LG Google Nexus 5).

I hope this information will help you analyze the problem.

Regards
Kotan
AdCubeTest.zip

Amy Quispe (AdMob SDK Team)

unread,
Jul 29, 2014, 7:40:52 PM7/29/14
to google-adm...@googlegroups.com
Hi Kotan,

It might take me a day or so to look at this. I'll get back to you ASAP.

Amy Quispe

Amy Quispe (AdMob SDK Team)

unread,
Aug 5, 2014, 7:34:02 PM8/5/14
to google-adm...@googlegroups.com
Hi Kotan,

I was unable to reproduce the first bug you mentioned. I've filed a bug for the second one.

Amy Quispe
Reply all
Reply to author
Forward
0 new messages