[Android ]IMA SDK crash on Fire Tablet

215 views
Skip to first unread message

Adrian Rodriguez

unread,
Jan 20, 2016, 9:20:41 AM1/20/16
to Interactive Media Ads SDK
Hi, I'm getting IMA SDK Crashes in a Fire app.

The initial load of ad works fine, but if I cancel the ad and start a new one (the user selected a different stream in the app, which will request a new ad to show to the user), then sometimes IMA crashes. It's not 100% reproducible. It happens after doing several switches. Sometimes the switch is done fine, but eventually in a switch when trying to load a new ad it will crash. The problem is not reproducible in Android devices.

The Fire tablet is the latest one (5th gen 7") and is based on android 5.1.1

This is the crash log:

System.err: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
01-20 15:05:00.075 2341-2341/ W/System.err:     at android.view.ViewGroup.addViewInner(ViewGroup.java:3949)
01-20 15:05:00.075 2341-2341/ W/System.err:     at android.view.ViewGroup.addView(ViewGroup.java:3799)
01-20 15:05:00.075 2341-2341/ W/System.err:     at android.view.ViewGroup.addView(ViewGroup.java:3771)
01-20 15:05:00.075 2341-2341/ W/System.err:     at com.google.ads.interactivemedia.v3.impl.a.f.a(IMASDK:28)
01-20 15:05:00.075 2341-2341/ W/System.err:     at com.google.ads.interactivemedia.v3.impl.j.a(IMASDK:105)
01-20 15:05:00.075 2341-2341/ W/System.err:     at com.google.ads.interactivemedia.v3.impl.j.a(IMASDK:73)
01-20 15:05:00.075 2341-2341/ W/System.err:     at com.google.ads.interactivemedia.v3.impl.aa.a(IMASDK:139)
01-20 15:05:00.075 2341-2341/ W/System.err:     at com.google.ads.interactivemedia.v3.impl.h$a.a(IMASDK:379)
01-20 15:05:00.075 2341-2341/ W/System.err:     at com.google.ads.interactivemedia.v3.impl.x.f(IMASDK:533)
01-20 15:05:00.075 2341-2341/ W/System.err:     at com.google.ads.interactivemedia.v3.impl.x.a(IMASDK:304)
01-20 15:05:00.075 2341-2341/ W/System.err:     at com.google.ads.interactivemedia.v3.impl.y.b(IMASDK:132)
01-20 15:05:00.075 2341-2341/ W/System.err:     at com.google.ads.interactivemedia.v3.impl.y$1.shouldOverrideUrlLoading(IMASDK:60)
01-20 15:05:00.075 2341-2341/a W/System.err:     at com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:359)
01-20 15:05:00.075 2341-2341/ W/System.err:     at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:261)
01-20 15:05:00.075 2341-2341/ W/System.err:     at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
01-20 15:05:00.075 2341-2341/ W/System.err:     at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
01-20 15:05:00.075 2341-2341/ W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
01-20 15:05:00.076 2341-2341/ W/System.err:     at android.os.Looper.loop(Looper.java:135)
01-20 15:05:00.076 2341-2341/ W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5468)
01-20 15:05:00.076 2341-2341/ W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
01-20 15:05:00.076 2341-2341/ W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
01-20 15:05:00.076 2341-2341/ W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:976)
01-20 15:05:00.076 2341-2341/ W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)

Vu Chau (IMA SDK Team)

unread,
Jan 20, 2016, 11:17:52 AM1/20/16
to Interactive Media Ads SDK
Hi Adrian,

Are you calling destroy() on the AdsManager before a switch occurs?  If you are trying to inflate and deflate views in between switches, be sure to also remove the view's parent first, as the log entry says, before adding the new view. 

Vu Chau
IMA SDK Team

Adrian Rodriguez

unread,
Jan 21, 2016, 3:23:14 AM1/21/16
to Interactive Media Ads SDK
Hi Vu,

Yes, destroy from the adsManager is always called before requesting new ads. Right after destroying the adsLoader, we are also removing all views from the adUiContainer of the adDisplayContainer just to be sure they are removed as we were having issues with this some time ago.

Basicaly the code for releaseAdPlayer is:

private void releaseAdPlayer() {
      L
.g(TAG, "releaseAdPlayer");
     
if (mAdsManager != null) {
          L
.g(TAG, "adsManager.destroy()");
          mAdsManager
.destroy();
          mAdsManager
= null;
     
}
     
if (mAdUiContainer != null) {
          mAdUiContainer
.removeAllViews();
     
}
      releaseExoPlayer
();
 
}


 I added a bit more logging to the app for you to understand the sequence of events:

01-21 09:12:05.428 6454-6454/ D/AdPlayer: AD onAdsManagerLoaded
01-21 09:12:14.425 6454-6454/ D/AdPlayer: AD onAdEvent: LOADED
01-21 09:12:16.432 6454-6454/ D/AdPlayer: AD onAdEvent: CONTENT_PAUSE_REQUESTED
01-21 09:12:19.420 6454-6454/ D/AdPlayer: AdPlayer.loadAd: http://ds.serving-sys.com/BurstingRes/Site-14584/Type-16/a5387e3e-c990-4d1c-abef-8d7e646ea852.mp4
01-21 09:12:20.472 6454-6454/ D/AdPlayer: callback.onPlay()
01-21 09:12:21.478 6454-6454/ D/AdPlayer: AdPlayer.playAd
01-21 09:12:25.146 6454-10001/ D/ZapiClient: request /zapi/watch success: {"stream": {"url": "url", "maxrate": 1500, "audio_channel": "A"}, {"url": "url", "maxrate": 600, "audio_channel": "A"}], "ad": {"vast_url": "http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/40762806/prel-10-de/prel-10-video/prel-10-cs/prel-10-android-tablet&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&url=http%3A%2F%2Fzattoo.com%2F&description_url=http%3A%2F%2Fzattoo.com%2F&correlator=[timestamp]&cust_params=uid%3Dfe3bbf8459c1415d80fa6ce9ad7d806d%26zuid%3D19449910%26random%3D9172137528299739442%26genresnext%3DHome%20Shopping%2CEconomy%26email_allowed%3D1%26genres%3DHome%20Shopping%2CEconomy%26title%3DTeleshopping%26variantgroup%3D0%26adcount%3D23%26clanguage%3Dde%26channel%3Dweltderwunder%26last_watch%3D26%26appversion%3D2006001%26titlenext%3DTeleshopping%26adid%3Dnull%26embed%3Dpartner_zapi%26email_valid%3D0%26language%3Dde%26gender%3Dnone%26session_id%3D5b011ea3c2d68c71a510e23d0c1b6b8e%26appid%3D87%26forerun%3D47", "type": "cs"}}, "success": true}
01-21 09:12:25.218 6454-6454/ D/AdPlayer: releaseAdPlayer
01-21 09:12:25.218 6454-6454/ D/AdPlayer: adsManager.destroy()
01-21 09:12:25.272 6454-6454/ D/AdPlayer: requestAd for ppid fe3bbf8459c1415d80fa6ce9ad7d806d: http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/40762806/prel-10-de/prel-10-video/prel-10-cs/prel-10-android-tablet&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&url=http%3A%2F%2Fzattoo.com%2F&description_url=http%3A%2F%2Fzattoo.com%2F&correlator=[timestamp]&cust_params=uid%3Dfe3bbf8459c1415d80fa6ce9ad7d806d%26zuid%3D19449910%26random%3D9172137528299739442%26genresnext%3DHome%20Shopping%2CEconomy%26email_allowed%3D1%26genres%3DHome%20Shopping%2CEconomy%26title%3DTeleshopping%26variantgroup%3D0%26adcount%3D23%26clanguage%3Dde%26channel%3Dweltderwunder%26last_watch%3D26%26appversion%3D2006001%26titlenext%3DTeleshopping%26adid%3Dnull%26embed%3Dpartner_zapi%26email_valid%3D0%26language%3Dde%26gender%3Dnone%26session_id%3D5b011ea3c2d68c71a510e23d0c1b6b8e%26appid%3D87%26forerun%3D47
01-21 09:12:41.432 6454-6454/ D/AdPlayer: AD onAdEvent: STARTED
01-21 09:12:41.761 6454-6454/ D/AdPlayer: AdPlayer.pauseAd
01-21 09:12:41.789 6454-6454/ D/AdPlayer: AD onAdsManagerLoaded
01-21 09:12:42.125 6454-6454/ D/AdPlayer: AD onAdEvent: LOADED
01-21 09:12:42.141 6454-6454/ D/AdPlayer: AD onAdEvent: CONTENT_PAUSE_REQUESTED
01-21 09:12:42.155 6454-6454/ D/AdPlayer: AdPlayer.loadAd: http://ad.71i.de/images/loreal/2016/138136/160113_Loreal_Men_Expert_Pure_Power_Motiv2_20sec.mp4
01-21 09:12:42.182 6454-6454/ D/AdPlayer: AdPlayer.playAd
01-21 09:12:42.741 6454-6454/ D/AdPlayer: callback.onPlay()
01-21 09:12:43.097 6454-6454/ W/System.err: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
01-21 09:12:43.101 6454-6454/ W/System.err: at android.view.ViewGroup.addViewInner(ViewGroup.java:3949)
01-21 09:12:43.101 6454-6454/ W/System.err: at android.view.ViewGroup.addView(ViewGroup.java:3799)
01-21 09:12:43.101 6454-6454/ W/System.err: at android.view.ViewGroup.addView(ViewGroup.java:3771)
01-21 09:12:43.102 6454-6454/ W/System.err: at com.google.ads.interactivemedia.v3.impl.a.f.a(IMASDK:28)
01-21 09:12:43.102 6454-6454/ W/System.err: at com.google.ads.interactivemedia.v3.impl.j.a(IMASDK:105)
01-21 09:12:43.102 6454-6454/ W/System.err: at com.google.ads.interactivemedia.v3.impl.j.a(IMASDK:73)
01-21 09:12:43.102 6454-6454/ W/System.err: at com.google.ads.interactivemedia.v3.impl.aa.a(IMASDK:139)
01-21 09:12:43.102 6454-6454/ W/System.err: at com.google.ads.interactivemedia.v3.impl.h$a.a(IMASDK:379)
01-21 09:12:43.102 6454-6454/ W/System.err: at com.google.ads.interactivemedia.v3.impl.x.f(IMASDK:533)
01-21 09:12:43.102 6454-6454/ W/System.err: at com.google.ads.interactivemedia.v3.impl.x.a(IMASDK:304)
01-21 09:12:43.102 6454-6454/ W/System.err: at com.google.ads.interactivemedia.v3.impl.y.b(IMASDK:132)
01-21 09:12:43.102 6454-6454/ W/System.err: at com.google.ads.interactivemedia.v3.impl.y$1.shouldOverrideUrlLoading(IMASDK:60)
01-21 09:12:43.102 6454-6454/ W/System.err: at com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:359)
01-21 09:12:43.102 6454-6454/ W/System.err: at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:261)
01-21 09:12:43.102 6454-6454/ W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5468)

Vu Chau (IMA SDK Team)

unread,
Jan 21, 2016, 11:09:41 AM1/21/16
to Interactive Media Ads SDK
Hi Adrian,

Thanks for the additional details! I am going to speak with the rest of the team about this issue - they will need a minimal code base that can reproduce this issue on the Fire tablet.  Would it be possible for you to provide us with a sample project?

Thanks,

Vu Chau
IMA SDK Team

Adrian Rodriguez

unread,
Jan 25, 2016, 4:06:24 AM1/25/16
to Interactive Media Ads SDK
Hi Vu,

Thanks for the response. I would appreciate any help you can give us with this issue.

Unfortunately it will not be easy to provide you with an example code, as our app is quite big and complex.
I'll see if I can make a minimised sample version but I doubt I can do it quickly.

In case your team discovers something related to the issue please let us know.

Vu Chau (IMA SDK Team)

unread,
Jan 25, 2016, 11:35:39 AM1/25/16
to Interactive Media Ads SDK
Hi Adrian,

Sure, I understand! Feel free to send us any sample you might have in the future.  That will greatly help us troubleshoot since we'd be able to see the issue live.  In the meantime, if we do have an update, you'll be the first one to know.

Vu Chau
IMA SDK Team

Adrian Rodriguez

unread,
Feb 5, 2016, 6:57:49 AM2/5/16
to Interactive Media Ads SDK
Hi again,

Checking our crash logs I can also see this happening in two devices with Android 4.2.2:
SAMSUNG GT-P5100
SAMSUNG GT-P5110

So it could be an issue on that android api level or a manufacturer introduced bug.

Vu Chau (IMA SDK Team)

unread,
Feb 5, 2016, 12:04:27 PM2/5/16
to Interactive Media Ads SDK
Hey Adrian,

Thanks for letting us know about the additional devices on which the crash occurs.  As I said, we'll still need a very simple and minified project that can reproduce the crash, so that we will be able to debug and identify any potential bugs.  Keep us in the loop regarding that.

Vu Chau
IMA SDK Team

Michael Len

unread,
Mar 2, 2016, 11:11:19 PM3/2/16
to Interactive Media Ads SDK
Hey All,

I ran into the same issue.  I debugged it quite a bit, and I think I found the issue:

"The specified child already has a parent" When I broke on the exception, i saw that "Child" was a Google IMA Webview of some sort.  the "Parent" was the layout that I passed into "setAdContainer".

My biggest hunch is that the IMA Webview is not properly removed from the Destroy().  I was able to get around it by calling "removeAllViews()" between Video Plays.

Hopefully this helps the team pinpoint the error, and maybe resolve in the future.  I've been able to work around it for now.

Thanks,
Mike

Vu Chau (IMA SDK Team)

unread,
Mar 3, 2016, 10:57:25 AM3/3/16
to Interactive Media Ads SDK
Hi Michael,

Thanks for sharing! I will relay the finding to the rest of the team.  In the meantime, for anyone experiencing this issue, feel free to try what Mike suggested and let us know if that temporarily resolves it.

Vu Chau
IMA SDK Team

Ning.Li

unread,
Sep 12, 2016, 4:50:14 AM9/12/16
to Interactive Media Ads SDK
Hi All,

I ran into the same issue,too. It occurs in the Samsung devices;

The SDK has been updated several times  this year,has this issue beed solved? 

Vu Chau (IMA SDK Team)

unread,
Sep 12, 2016, 9:41:16 AM9/12/16
to Interactive Media Ads SDK
Hi Ning,

We have never managed to reproduce the issue locally, so there was no fix for this.  Feel free to implement the suggestion from Michael above - that should help sidestep the crash.

Vu Chau
IMA SDK Team

Reply all
Reply to author
Forward
0 new messages