question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IMA shouldOverrideUrlLoading NPEs

See original GitHub issue

Issue description

We are seeing a lot of NullPointerException’s in Firebase coming from IMA in our latest release, containing ExoPlayer 2.12.0 and IMA 3.21.4 (Note: ExoPlayer specifies 3.21.0, so we’ve bumped it slightly).

GIven it’s IMA and obfuscated it’s hard to work out exactly what is going wrong from our perspective. It seems like at some point the WebView is triggering a URL load, which is causing IMA to call into components it thinks should not be null, but are at that point.

I’m guessing it’s some kind of lifecycle thing, maybe ExoPlayer has detached when this event occurs or hasn’t attached yet. Hoping someone who has worked with the IMA code could shed some light / point me in the right direction.

Reproduction steps

I have been so far unable to reproduce this, or find a specific flow making it happen.

Link to test content

Not content specific.

Stacktraces

Note, the actual crashes have repeats of this due to the way WebViews are implemented across devices.

Crash 1

Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object com.google.ads.interactivemedia.v3.api.StreamRequest.getUserRequestContext()' on a null object reference
       at com.google.ads.interactivemedia.v3.internal.amr.c(IMASDK:3)
       at com.google.ads.interactivemedia.v3.internal.aog.d(IMASDK:66)
       at com.google.ads.interactivemedia.v3.internal.aom.d(IMASDK:5)
       at com.google.ads.interactivemedia.v3.internal.aoj.shouldOverrideUrlLoading(IMASDK:2)
       at android.webkit.WebViewClient.shouldOverrideUrlLoading(WebViewClient.java:77)
       at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(chromium-Monochrome.aab-stable-428010123:17)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:326)
       at android.os.Looper.loop(Looper.java:165)
       at android.app.ActivityThread.main(ActivityThread.java:6810)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

Crash 2

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.ads.interactivemedia.v3.internal.and.g()' on a null object reference
       at com.google.ads.interactivemedia.v3.internal.amr.a(IMASDK:2)
       at com.google.ads.interactivemedia.v3.internal.aog.d(IMASDK:71)
       at com.google.ads.interactivemedia.v3.internal.aom.d(IMASDK:5)
       at com.google.ads.interactivemedia.v3.internal.aoj.shouldOverrideUrlLoading(IMASDK:2)
       at android.webkit.WebViewClient.shouldOverrideUrlLoading(WebViewClient.java:77)
       at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(chromium-Monochrome.aab-stable-428014120:17)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:326)
       at android.os.Looper.loop(Looper.java:183)
       at android.app.ActivityThread.main(ActivityThread.java:7258)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)

Version of ExoPlayer being used

2.12.0 with IMA 3.21.4

Device(s) and version(s) of Android being used

Device and OS independent

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

5reactions
andrewlewiscommented, Mar 15, 2021

A fix has been submitted for this. I’ll look out for the next IMA SDK update and hopefully we can get that into the next minor release.

3reactions
AlienAsRogercommented, Mar 17, 2021

@fpitters looks like IMA SDK team has release a fix for the NPE crash https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/history We will try to see if it’s fixes our issue in production which is identical to your report.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NPE in IMA Android 3.22.2 - Google Groups
We are getting a NPE exception reported on Firebase/GPlay (Nothing we can reproduce locally): Fatal Exception: java.lang.
Read more >
Android - Load WebView from Asset using a Spinner
So I have a spinner that needs to populate a WebView using an HTML file located in the assets folder. I have my...
Read more >
NullPointerException AdChoise link - Forums
shouldOverrideUrlLoading (AdWebViewClient.java:126) at ... I tested it on 2 distinct(Non-Amazon) devices and on both the NPE is thrown.
Read more >
MyWebViewClient.java example - Javatips.net
This class describes the usage of MyWebViewClient.java.
Read more >
Diff - c11f46f41662feebbbd2184aaef25c14add45e7d^2 ... - Google Git
String); + method public boolean shouldOverrideUrlLoading(android.webkit. ... methods from within this constructor can cause NPEs in existing - * apps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found