Re: NPE in Bitmap.getWidth() in IMA SDK 3.22.3

195 views
Skip to first unread message
Message has been deleted

Alex S

unread,
Mar 18, 2021, 8:33:20 PM3/18/21
to Interactive Media Ads SDK
Formatted stack trace 

java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$4.done(AsyncTask.java:399)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at com.google.ads.interactivemedia.v3.internal.ea.a(ea:3)
        at com.google.ads.interactivemedia.v3.internal.dy.doInBackground(dy:2)
        at android.os.AsyncTask$3.call(AsyncTask.java:378)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)


On Thursday, March 18, 2021 at 5:29:16 PM UTC-7 Alex S wrote:
This is our top crash for Android app in production. We can't reproduce it locally 

java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done(AsyncTask.java:399) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at com.google.ads.interactivemedia.v3.internal.ea.a(ea:3) at com.google.ads.interactivemedia.v3.internal.dy.doInBackground(dy:2) at android.os.AsyncTask$3.call(AsyncTask.java:378) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)


This is VAST TAG that we have 
VAST tag url = https://pubads.g.doubleclick.net/gampad/ads?iu=/15480783/Mobile-Preroll-Video/Android&correlator=1616112703268&env=vp&impl=s&url=tunein.player&gdfp_req=1&output=vast&unviewed_position_start=1&ciu_szs=300x250&description_url=https%3A%2F%2Ftunein.com%2Fdesc%2Fs47704%2F&sz=1x1%7C400x300%7C640x360%7C640x480&us_privacy=1YNY&gdpr=0&gdpr_consent=&cust_params=useragent%3DTuneIn+Radio-26.3+%28Android-29%3B+Redmi+Note+8T%3B+Java%29%26partnerId%3DxwhZkVKi%26ListingId%3Ds47704%26genre_id%3Dg61%26class%3Dmusic%26stationId%3Ds47704%26is_mature%3Dfalse%26is_family%3Dfalse%26is_event%3Dfalse%26is_ondemand%3Dfalse%26language%3Des_US%26version%3D26.3%26persona%3DSpanish%26is_new_user%3Dfalse%26device%3Dphone%26country_region_id%3D101271%26videoEnabled%3Dtrue%26audioEnabled%3Dtrue%26station_language%3DEspa%C3%B1ol%26categoryId%3Dhome%26screen%3Dnowplaying%26isFirstInSession%3Dtrue%26videoPrerollPlayed%3Dfalse%26age%3D51%26abtest%3D4441%26lotamesegments%3DW22%2Call%2CW18%2Cx9x%2Cx3x%26premium%3Dfalse%26msid%3Dtunein.player

IMA SDK

unread,
Mar 19, 2021, 1:08:11 AM3/19/21
to ima...@googlegroups.com

Hi Alex,

Thank you for bringing this issue to our attention.

I tried using the ad tag you shared against our advanced sample app with SDK v3.22.3 on emulator (Pixel 3 API 28), but the crash issue is not reproducible as I’m getting an ad error (please see attached). When using the default ad tag, the app works properly without any issue. Were you able to replicate the crash using the above sample app? In case yes, could you kindly share with us the steps in order to reproduce the issue?

Also, I’m going to delete your previous message in this thread to mask the ad tag that you shared. Please below for your reference.


Regards,


Google Logo
Sherwin Diesta
IMA SDK Team
 

------


 

This is our top crash for Android app in production. We can't reproduce it locally 

 

java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done(AsyncTask.java:399) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at com.google.ads.interactivemedia.v3.internal.ea.a(ea:3) at com.google.ads.interactivemedia.v3.internal.dy.doInBackground(dy:2) at android.os.AsyncTask$3.call(AsyncTask.java:378) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)

 

This issue is similar to https://groups.google.com/g/ima-sdk/c/BvHHkeXvhL4 which also referenced here https://github.com/google/ExoPlayer/issues/8447 

 

This is VAST TAG that we have 

VAST tag url = xxxxxxxxxxxxxxxxx


 

ref:_00D1U1174p._5004Q2DwzJr:ref
emulator-test.png

Alex S

unread,
Mar 19, 2021, 9:56:23 AM3/19/21
to Interactive Media Ads SDK
Hi Sherwin!

Unfortunately we were not able to reproduce this crash on our side. By looking at stack trace and obfuscated code I think this is happening when decoding of Bitmap is returning a null but there is no verification that Bitmap has been successfully decoded


final Bitmap a(String var1) throws IOException {
URL var2 = new URL(var1);
Bitmap var3 = BitmapFactory.decodeStream(var2.openConnection().getInputStream());
return this.f.a == var3.getWidth()
&& this.f.b == var3.getHeight() && !axk.a((double)this.b) ? Bitmap.createScaledBitmap(var3, (int)(this.b * (float)var3.getWidth()), (int)(this.b * (float)var3.getHeight()), true) : var3;
}

public final void onClick(View var1) {
Iterator var2 = this.e.iterator();

while(var2.hasNext()) {
((ClickListener)var2.next()).onCompanionAdClick();
}

this.c.p(this.a.clickThroughUrl()); <--- stack trace points here, but there is no Bitmap
}


Looking at method signature

@Nullable
public static Bitmap decodeStream(@Nullable InputStream is, @Nullable Rect outPadding,

decode stream is returning @Nullable, so it's preferable to check if result is not null in this part

Bitmap var3 = BitmapFactory.decodeStream(var2.openConnection().getInputStream());
return this.f.a == var3.getWidth() 


Screen Shot 2021-03-19 at 6.53.48 AM.png

Please let me know what do you think.

Thank you,
Alex.

IMA SDK

unread,
Mar 19, 2021, 12:28:04 PM3/19/21
to ima...@googlegroups.com
Hi Alex,

I work with Sherwin and will assist you. Thank you for reporting all this, my team is currently looking into it and we will get back to you as soon as possible.

Regards,

Google Logo
Aryeh Baker
IMA SDK Team
 


ref:_00D1U1174p._5004Q2DwzJr:ref

Alex S

unread,
Mar 19, 2021, 12:40:18 PM3/19/21
to Interactive Media Ads SDK
Hi Aryeh,

Thank you so much! 

Alex S

unread,
Mar 25, 2021, 3:56:38 PM3/25/21
to Interactive Media Ads SDK
Hello Aryeh!

Do you have any updates on this issue?

Thank you,
Alex

IMA SDK

unread,
Mar 25, 2021, 4:06:39 PM3/25/21
to ima...@googlegroups.com
Hi Alex,

It appears my team has found a fix. Stay tuned for when it becomes live, I will update you on this thread.

Alex S

unread,
Mar 31, 2021, 6:51:01 PM3/31/21
to Interactive Media Ads SDK
Hello Aryeh,

just wanted to follow up. This crash is significant to our app in production and have negative impact on our metrics. Could you please provide some estimation on when this will be available to the public use? 

Thank you,
Alex.

IMA SDK

unread,
Apr 1, 2021, 9:11:47 AM4/1/21
to ima...@googlegroups.com
Hi Alex,

Thank you for reaching back out to us. I have looked into the feedback that our team has given us on this and while we do not know exactly when this should be going live. It should be soon. Chances are I would look to see if anything happens around Tuesday's? While this is not a guarantee, this is when we have usually seen releases done. Of course something can always happen before or after that.

Regards,
Google Logo
William Pescherine
IMA SDK Team
 


ref:_00D1U1174p._5004Q2DwzJr:ref

Alex S

unread,
Apr 1, 2021, 9:38:04 AM4/1/21
to Interactive Media Ads SDK
Hi William!

Thank you for the information! We will be looking forward to it.

Thank you,
Alex.

Alex S

unread,
Apr 6, 2021, 7:07:51 PM4/6/21
to Interactive Media Ads SDK
Hi William! 

just wanted to check in to see if there has been any updates planned regarding this issue. 

Thank you,
Alex.

IMA SDK

unread,
Apr 7, 2021, 2:42:12 AM4/7/21
to ima...@googlegroups.com

Hi Alex,

Thank you for your message. Looking at the most recent response from our team, I believe that we already found a solution to this case. We will keep you posted once it goes live.

Regards,


Google Logo
Sherwin Diesta
IMA SDK Team
 


ref:_00D1U1174p._5004Q2DwzJr:ref

IMA SDK

unread,
Apr 7, 2021, 3:52:12 PM4/7/21
to ima...@googlegroups.com
Hi Alex,

I have good news, we believe the solution is in our latest SDK version 3.23.0. Please get back to us on this thread if you still encounter this issue after updating.

Regards,

Google Logo
Aryeh Baker
IMA SDK Team
 


ref:_00D1U1174p._5004Q2DwzJr:ref
Reply all
Reply to author
Forward
0 new messages