stopAd incorrectly set as @NonNull (Causing crash)

171 views
Skip to first unread message

Matthew Murray

unread,
Jan 23, 2024, 2:02:42 PMJan 23
to Interactive Media Ads SDK
I'm getting a crash in Android IMA SDK 3.31.1 when a video finishes and the stopAd() method is being called with a null AdMediaInfo parameter, even though it's explicitly set as @NonNull.

I'm implementing the `VideoAdPlayer` interface in order to support VAST in my video player, so implementing the `void stopAd(@NonNull AdMediaInfo var1)` method is required. Since the crash occurs **before** the method enters into my function there is seemingly nothing that I can do about it on my end.

The fix should be simple for the IMA SDK- revert `VideoAdPlayer` to assume all parameters as nullable like they used to be.

Stack Trace:
W/System.err: java.lang.NullPointerException: Parameter specified as non-null is null: method net.nativo.sdk.video.VastVideoPlayer.stopAd, parameter p0 W/System.err: at net.nativo.sdk.video.VastVideoPlayer.stopAd(Unknown Source:2) W/System.err: at com.google.ads.interactivemedia.v3.impl.zzbc.zzf(com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:3) W/System.err: at com.google.ads.interactivemedia.v3.impl.zzau.zzr(com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:3) W/System.err: at com.google.ads.interactivemedia.v3.impl.zzau.zzl(com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:118) W/System.err: at com.google.ads.interactivemedia.v3.impl.zzbb.zzf(com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:7) W/System.err: at com.google.ads.interactivemedia.v3.impl.zzax.onPostMessage(com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:2) W/System.err: at androidx.webkit.internal.WebMessageListenerAdapter.onPostMessage(WebMessageListenerAdapter.java:55) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil$InvocationHandlerWithDelegateGetter.invoke(BoundaryInterfaceReflectionUtil.java:162) W/System.err: at java.lang.reflect.Proxy.invoke(Proxy.java:1006) W/System.err: at $Proxy4.onPostMessage(Unknown Source) W/System.err: at org.chromium.android_webview.WebMessageListenerHolder.onPostMessage(chromium-TrichromeWebViewGoogle6432.apk-stable-567263637:53) W/System.err: at android.os.MessageQueue.nativePollOnce(Native Method) W/System.err: at android.os.MessageQueue.next(MessageQueue.java:335) W/System.err: at android.os.Looper.loopOnce(Looper.java:162) W/System.err: at android.os.Looper.loop(Looper.java:294) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:8177) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) A/chromium: [FATAL:jni_android.cc(289)] Please include Java exception stack in crash report A/libc: Fatal signal 5 (SIGTRAP), code 128 (SI_KERNEL), fault addr 0x0 in tid 13748 (ativo.sampleapp), pid 13748 (ativo.sampleapp)
Message has been deleted

IMA SDK

unread,
Jan 23, 2024, 3:46:24 PMJan 23
to ima...@googlegroups.com, mmu...@nativo.com

Hi,

Thank you for contacting the IMA SDK support team.

I understand you are facing crash issue in android device.

Could you try once with latest SDK version? if the issue still persist, kindly share your Sample Project for further investigation so that we can have full visibility on your implementation.

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, kindly provide requested information to us via reply privately to author option or using the steps below:

1. Navigate to

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

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.!5004Q02rYHKZ:ref"

Thanks,
 
Google Logo IMA SDK Team


Matthew Murray

unread,
Jan 24, 2024, 3:02:43 PMJan 24
to Interactive Media Ads SDK
Correction: I am using 3.31.0, which according to https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/history is the latest version.

Is there another version I can try?

IMA SDK

unread,
Jan 24, 2024, 6:35:49 PMJan 24
to mmu...@nativo.com, ima...@googlegroups.com
Hi,

Thank you for getting back to us.

I've checked Google Sample Project and unable to get this error, It is working fine and handled properly by passing MediInfo as null in stop ad parameter.
Can you try once from your end in Google Sample Project.

For testing purpose, call stopAd with mediainfo null in FIRST_QUARTILE adsManager.addAdEventListener.
then destroy();

Please get back to us if you face any other issue.

Matthew Murray

unread,
Feb 13, 2024, 8:01:29 PMFeb 13
to Interactive Media Ads SDK
Hi again,

Sorry for the delayed response. Focusing on this again. I checked out your project and did what you asked and it does indeed doesn't crash when in Java. However, I converted `VideoPlayerWithAdPlayback` to Kotlin and it then does crash.  Checkout my project for reference, where I've recreated the crash. The reason is as I stated previously, the VideoAdPlayer interface in 3.31.0 explicitly states the input parameter cannot be null, so when the Kotlin compiler sees a null value, it will assert non null and will crash the app.

Please make this a high priority and fix this crash ASAP.

Thanks,
Matt M



IMA SDK

unread,
Feb 13, 2024, 10:00:45 PMFeb 13
to mmu...@nativo.com, ima...@googlegroups.com

Hi Matt,



Thank you for getting back to us.

I will check with our team regarding your issue and one of my team members will reach out to you once we have an update on this. Meanwhile, your patience is highly appreciated. 

Matthew Murray

unread,
Feb 14, 2024, 3:05:43 PMFeb 14
to Interactive Media Ads SDK
Great, thank you. In your honest assessment what do you think the ETA will be for this fix? If it will be a while should I simply convert my VideoAdPlayer to Java?

IMA SDK

unread,
Feb 15, 2024, 1:41:46 PMFeb 15
to mmu...@nativo.com, ima...@googlegroups.com
Hi Matthew,

Unfortunately, I don't have a solid ETA on this fix at the moment. I have filed the bug report and prioritized it, but it will take a few days at minimum to cut a new release. That said, the vast majority of our publishers are still on Java, so you may find it to be a smoother pathway, with regards to documentation, samples and troubleshooting.

Thanks,

Greg Schoppe
IMA SDK Team

ref:!00D1U01174p.!5004Q02rYHKZ:ref

Matthew Murray

unread,
Apr 1, 2024, 2:41:13 PMApr 1
to Interactive Media Ads SDK
Do we know if this issue was fixed with v23.0.0?

IMA SDK

unread,
Apr 3, 2024, 11:45:49 AMApr 3
to mmu...@nativo.com, ima...@googlegroups.com
Hi Matthew,

Unfortunately I do not believe the 23.0.0 release contains this fix, as it contains a hotfix for another urgent issue. I'll update this thread when the issue is marked as resolved in our internal bug tracker.

Yevhen Huzyk

unread,
Apr 16, 2024, 9:53:57 AMApr 16
to Interactive Media Ads SDK
Hi IMA team,

This issue also happens in other methods like pauseAd and playAd for us.

I hope you'll be able to fix it soon.

Thanks!

IMA SDK

unread,
Apr 17, 2024, 7:18:04 PMApr 17
to ima...@googlegroups.com
Hi all,

This is Jackson from the IMA SDK team, stepping in for Greg while he is out of office. I wanted to confirm, since there was mention of a v23.0.0. This is an Android IMA SDK issue, specific to Kotlin apps, and the latest IMA version was v3.33.0?

I'll look into the progress on this fix, and reply with an update on this thread.

Thank you,
Jackson
IMA SDK team

ref:!00D1U01174p.!5004Q02rYHKZ:ref

Yevhen Huzyk

unread,
Apr 18, 2024, 2:38:11 AMApr 18
to Interactive Media Ads SDK
Hi Jackson,

This is an Android IMA SDK issue. We are using the v3.31.0 supplied with the Media3 v1.3.1 IMA extension.

The issue is not specific to Java or Kotlin. It is crashing if the app is in Kotlin because the parameter supplied as null to the function with non-null parameter.
Whereas if the app is in Java - it won't crash because of this reason, but it also doesn't eliminate the root issue.

The root issue is that these methods (playAd, stopAd, pauseAd) are being invoked with the null parameter for AdMediaInfo.
The parameter must be supplied in order to be able to proceed with the correct business logic in the app.
For example if the playAd method is invoked with null parameter - we are unable to play any Ad because the AdMediaInfo is null, so we should write logic to ignore it anyways.

As a temporary solution I implemented this part of the code in Java to allow the SDK to pass null parameter (so that the app doesn't crash) and we just ignore null values of AdMediaInfo in all 3 methods (playAd, stopAd, pauseAd).

In the logs from users I see that is some cases these methods are being invoked randomly after the Ad flow is completed and we cleared all the resources like AdsManager and AdsLoader.

Thanks,
Yevhen

IMA SDK

unread,
Apr 18, 2024, 11:52:30 AMApr 18
to ima...@googlegroups.com
Hello Yevhen,

Thank you for clarifying the issue. I checked with the team on this, and the expectation for IMA is that until the ALL_ADS_COMPLETED event is fired, IMA resources (like AdsManager and AdsLoader) should not be destroyed. Does your app wait for the completed event to do IMA cleanup?

I will check with the team if there are changes IMA can make to better protect against this error, and add any updates to this thread.

I will also check in with Greg once he is back next week, since he may have more info.

Please let me know if you have any questions.

Yevhen Huzyk

unread,
Apr 22, 2024, 7:35:30 AMApr 22
to Interactive Media Ads SDK
Hey!

Sometimes we don't wait for the ALL_ADS_COMPLETED event to be fired because in our users flow we should have a possibility to destroy and clean up the resources at any point of time, for example on users action to navigate through the app.

I think the IMA sdk should expect the flow to be interrupted for any reason.

Thank you!
Yevhen

IMA SDK

unread,
Apr 22, 2024, 4:59:52 PMApr 22
to ima...@googlegroups.com
Hello Yevhen,

If you are calling AdsManager.destory(), I would not expect any issues like you are reporting. Let me share this information with the team and I will let you know about any updates. When I do, I will add the update here.
Reply all
Reply to author
Forward
0 new messages