Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference

571 views
Skip to first unread message

Hien TT

unread,
Jul 1, 2025, 1:01:05 PMJul 1
to Google Mobile Ads SDK Developers
Dear Google Mobile Ads SDK Support Team,
 I am consistently encountering a `NullPointerException` within the Google Mobile Ads SDK, specifically when attempting to invoke `getWidth()` on a null Bitmap object. This fatal exception leads to application crashes for some of my users.
It occurs almost SDK version include the latest (24.4.0 or 24.0.0lite)

 **Stack Trace:**

          Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
       at android.graphics.Bitmap.createBitmap(Bitmap.java:835)
       at com.google.android.gms.ads.internal.gmsg.aq.a(:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:1125)
       at com.google.android.gms.ads.internal.webview.r.x(:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:52)
       at com.google.android.gms.ads.internal.webview.r.e(:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:100)
       at com.google.android.gms.ads.internal.webview.an.run(:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:27)
       at android.os.Handler.handleCallback(Handler.java:942)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at m.bbd.a(:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:1)
       at com.google.android.gms.ads.internal.util.f.a(:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:1)
       at m.bbd.dispatchMessage(:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:1)
       at android.os.Looper.loopOnce(Looper.java:223)
       at android.os.Looper.loop(Looper.java:324)
       at android.app.ActivityThread.main(ActivityThread.java:8481)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1061)
       
I'd like to share some info from firebase.
Screenshot 2025-06-28 at 21.44.22.png

If you need more infos, please let me know.
Thank you very much.
 

Mobile Ads SDK Forum Advisor

unread,
Jul 1, 2025, 5:44:43 PMJul 1
to tohie...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for contacting the Mobile Ads SDK Support team.

I ran the Google Android BannerExample in the GMA SDK version “24.4.0”, samsung emulator running Android 14 and the reported issue “NullPointerException” is not replicating. Can you please confirm whether the mentioned issue is replicating in our Google Android samples? If so, kindly share the below details privately for further investigation:

  • app ID & ad unit ID
  • Charles logs
  • Full Stack trace
  • Steps to reproduce the crash
  • Sample project reproducing the crash

You can provide the following details via reply privately to the author option or below link.

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, you can share your files with me by performing the following steps:

1. Navigate to

https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=Mobile+Ads+SDK&entry.460850823=500Ht00001rgsbcIAA&entry.80707362=00316666

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.

Thanks,
 
Google Logo Mobile Ads SDK Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-07-01 21:43:54Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01rgsbc:ref" (ADR-00316666)



Sam Lu

unread,
Jul 10, 2025, 1:00:45 PMJul 10
to Google Mobile Ads SDK Developers
I also see the same error with ads-lite 24.0.0. It cannot be reproduced, but it occurs frequently.


java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
       at android.graphics.Bitmap.createBitmap(Bitmap.java:883)

       at com.google.android.gms.ads.internal.gmsg.aq.a(:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:1125)
       at com.google.android.gms.ads.internal.webview.r.x(:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:52)
       at com.google.android.gms.ads.internal.webview.r.e(:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:100)
       at com.google.android.gms.ads.internal.webview.r.shouldOverrideUrlLoading(:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:30)
       at android.webkit.WebViewClient.shouldOverrideUrlLoading(WebViewClient.java:91)
       at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(chromium-TrichromeWebViewGoogle6432.aab-stable-715111533:115)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)


Sam Lu

unread,
Jul 10, 2025, 1:00:48 PMJul 10
to Google Mobile Ads SDK Developers
I also see the same error with ads-lite 24.0.0
It cannot be reproduced, but it occurs frequently.

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
       at android.graphics.Bitmap.createBitmap(Bitmap.java:883)
       at com.google.android.gms.ads.internal.gmsg.aq.a(:com.google.android.gms.policy_ads_fdr_dynamite
       at com.google.android.gms.ads.internal.webview.r.x(:com.google.android.gms.policy_ads_fdr_dynamite
       at com.google.android.gms.ads.internal.webview.r.e(:com.google.android.gms.policy_ads_fdr_dynamite
       at com.google.android.gms.ads.internal.webview.r.shouldOverrideUrlLoading(:com.google.android.gms.policy_ads_fdr_dynamite

Mobile Ads SDK Forum Advisor

unread,
Jul 10, 2025, 7:34:03 PMJul 10
to a0s...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for contacting the Mobile Ads SDK Support team.

We understand that you're encountering the following NullPointerException related to Bitmap.getWidth() in the Ads Lite 24.0.0 SDK

Although it appears to be intermittent and difficult to reproduce, we'd like to investigate this further. To assist with debugging, could you please provide the following:

  • Charles logs
  • Sample project that reproduces the issue
  • Device details and Android versions where this crash occurs most frequently

Additionally, we recommend updating to the latest version of the Mobile Ads Lite SDK — version 24.3.0 — as it includes several stability improvements that may help resolve or mitigate this issue.

Kindly provide the requested details via Reply privately to author option

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, you can share your files with me by performing the following steps:

1. Navigate to

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.

Thanks,
 
Google Logo Mobile Ads SDK Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-07-10 23:33:04Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01svIpB:ref" (ADR-00318276)



Timo

unread,
Jul 14, 2025, 10:31:53 AMJul 14
to Google Mobile Ads SDK Developers
I'm seeing the exact same problem for my app since about a month - I am using collapsible banner ads.
I cannot replicate the issue on my devices, but it's happening for a significant share of my users.
I'm also seeing this stack trace, with references to "android.webkit.WebViewClient.shouldOverrideUrlLoading" - maybe this helps tracking down the issue:

          Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
       at android.graphics.Bitmap.createBitmap(Bitmap.java:883)
       at com.google.android.gms.internal.ads.zzbsm.zzc(zzbsm.java:47)
       at com.google.android.gms.internal.ads.zzbkk.zza(com.google.android.gms:play-services-ads@@24.4.0:16)
       at com.google.android.gms.internal.ads.zzcfm.zzaa(zzcfm.java:6)
       at com.google.android.gms.internal.ads.zzcfm.zzn(zzcfm.java:17)
       at com.google.android.gms.internal.ads.zzcfm.shouldOverrideUrlLoading(zzcfm.java:31)

       at android.webkit.WebViewClient.shouldOverrideUrlLoading(WebViewClient.java:91)
       at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(chromium-TrichromeWebViewGoogle6432.aab-stable-715111533:115)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.nextLegacy(MessageQueue.java:913)
       at android.os.MessageQueue.next(MessageQueue.java:1025)
       at android.os.Looper.loopOnce(Looper.java:196)
       at android.os.Looper.loop(Looper.java:338)
       at android.app.ActivityThread.main(ActivityThread.java:9067)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)

Timo

unread,
Jul 15, 2025, 2:21:41 AMJul 15
to Google Mobile Ads SDK Developers
I see the same crash, same stack trace and not reproducible locally. I am using collapsible banner ads only.
The crash started to happen around a month ago without changes or app update on my side.
Happens in AdMob SDK version 24.4.0 and Lite SDK 24.0.0 - the Ads Lite SDK 24.3.0 that you suggest to test is not available  (at least on the Maven repository)

App Hood

unread,
Jul 15, 2025, 2:26:57 AMJul 15
to Google Mobile Ads SDK Developers
I am also facing it. 
>
Exception java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at android.graphics.Bitmap.createBitmap (Bitmap.java:940) at com.google.android.gms.ads.internal.gmsg.aq.a (:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:1125) at com.google.android.gms.ads.internal.webview.r.x (:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:52) at com.google.android.gms.ads.internal.webview.r.e (:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:100) at com.google.android.gms.ads.internal.webview.an.run (:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:27) at android.os.Handler.handleCallback (Handler.java:938) at android.os.Handler.dispatchMessage (Handler.java:99) at m.bbd.a (:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:1) at com.google.android.gms.ads.internal.util.f.a (:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:1) at m.bbd.dispatchMessage (:com.google.android.gms.policy_ads_fdr_dynamite@250505305@250505301017.720652128.720652128:1) at android.os.Looper.loopOnce (Looper.java:241) at android.os.Looper.loop (Looper.java:342) at android.app.ActivityThread.main (ActivityThread.java:8124) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:583) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1045)
admob-nullpointer.png 

Mobile Ads SDK Forum Advisor

unread,
Aug 6, 2025, 2:04:47 AMAug 6
to a0s...@gmail.com, timo....@gmail.com, google-adm...@googlegroups.com
Hello all,


Thanks for reporting the errors.

To help with our investigation, can you provide the full stack trace from all threads?


 

Thanks,
 
Google Logo
Joshua
Mobile Ads SDK Team


Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-08-06 06:03:41Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01svIpB:ref" (ADR-00318276)



jasstudio

unread,
Aug 6, 2025, 5:21:32 AMAug 6
to Google Mobile Ads SDK Developers

I found this crash Reason.
This crash actually facing in Collapsible Banner. The use case was, you have multiple activities or fragment,
In Screen A you request for the AD, and before loading navigate to  next screen B, and screen B also load collapsible banner ,
you can repeat this activity you will face crash. 
Device info - 45%
Galaxy A12
45%
Android 13

 
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
    android.graphics.Bitmap.createBitmap(Bitmap.java:750)
    com.google.android.gms.internal.ads.zzbsj.zzc(com.google.android.gms:play-services-ads@@24.3.0:47)
    com.google.android.gms.internal.ads.zzbkd.zza(com.google.android.gms:play-services-ads@@24.3.0:16)
    com.google.android.gms.internal.ads.zzcfj.zzaa(com.google.android.gms:play-services-ads@@24.3.0:6)
    com.google.android.gms.internal.ads.zzcfj.zzn(com.google.android.gms:play-services-ads@@24.3.0:17)
    com.google.android.gms.internal.ads.zzcgh.zza(com.google.android.gms:play-services-ads@@24.3.0:4)
    com.google.android.gms.internal.ads.zzcgf.run(com.google.android.gms:play-services-ads@@24.3.0:4)
    android.os.Handler.handleCallback(Handler.java:873)
    android.os.Handler.dispatchMessage(Handler.java:99)
    com.google.android.gms.internal.ads.zzfrl.zza(com.google.android.gms:play-services-ads-api@@24.3.0)
    com.google.android.gms.ads.internal.util.zzf.zza(com.google.android.gms:play-services-ads@@24.3.0)
    com.google.android.gms.internal.ads.zzfrl.dispatchMessage(com.google.android.gms:play-services-ads-api@@24.3.0)
    android.os.Looper.loop(Looper.java:193)
    android.app.ActivityThread.main(ActivityThread.java:6819)
    java.lang.reflect.Method.invoke(Method.java)
    com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:497)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:912)

Timo P.

unread,
Aug 6, 2025, 5:21:54 AMAug 6
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com
Hello,

please see the crash logs / stack traces attached.
Let me know if you need additional ones.

Timo

Von: Mobile Ads SDK Forum Advisor <mobile...@forumsupport.google>
Gesendet: Mittwoch, 6. August 2025 08:03
An: a0s...@gmail.com <a0s...@gmail.com>; timo....@gmail.com <timo....@gmail.com>
Cc: google-adm...@googlegroups.com <google-adm...@googlegroups.com>
Betreff: RE: [google-admob-ads-sdk] fatal exception: java.lang.nullpointerexception attempt to invoke virtual method 'int android.graphics.bitmap.getwidth()' on a null object reference
 
partl.atomicclock_issue_59e7da434f291393b64d6faa87a4861a_crash_session_68912D2A0263000119336F449E95E85A_DNE_0_v2_stacktrace.txt
partl.atomicclock_issue_59e7da434f291393b64d6faa87a4861a_crash_session_6892E1BF00D7000165FB62FDF69D24D0_DNE_0_v2_stacktrace.txt
partl.atomicclock_issue_d08649f38a3c2da1efebfa617b0578a4_crash_session_6892B99E0276000154D96FC6DD010E23_DNE_0_v2_stacktrace.txt
partl.atomicclock_issue_59e7da434f291393b64d6faa87a4861a_crash_session_6890AE830281000117317EE1220581EF_DNE_0_v2_stacktrace.txt

Mobile Ads SDK Forum Advisor

unread,
Aug 6, 2025, 11:04:32 AMAug 6
to jasst...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for contacting the Mobile Ads SDK Support team.

​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.


Thanks,
 
Google Logo Mobile Ads SDK Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-08-06 15:03:42Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01rgsbc:ref" (ADR-00316666)



Mobile Ads SDK Forum Advisor

unread,
Aug 8, 2025, 2:34:10 PMAug 8
to timo....@gmail.com, google-adm...@googlegroups.com
Hello all,

Thank you all for providing the stack trace!

We are currently looking into the issue and will get back to this thread as soon as there is an update.

 

Thanks,
 
Google Logo
Joshua
Mobile Ads SDK Team


Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-08-08 18:33:08Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01svIpB:ref" (ADR-00318276)



Reply all
Reply to author
Forward
0 new messages