NullPointerException in play-services-ads during MobileAds.initialize() when app is inactive with onTrimMemory triggered

23 views
Skip to first unread message

Semyon Zadorozhnyi

unread,
Oct 27, 2025, 1:59:14 AM (5 days ago)  Oct 27
to Google Mobile Ads SDK Developers

A fatal NullPointerException occurs in the Google Play Services Ads library when initializing Mobile Ads while the app is in an inactive state. The crash happens specifically when the system triggers onTrimMemory after the app has been backgrounded for an extended period.

Key info:

Platform: Android 
Version: all versions from 10 to 15
Library Version: com.google.android.gms:play-services-ads 24.4.0

Stack Trace Root: 
Fatal Exception: java.lang.NullPointerException
Attempt to invoke interface method 'void com.google.android.gms.ads.internal.client.zzck.zzo(com.google.android.gms.internal.ads.zzbpo)' on a null object reference
com.google.android.gms.ads.internal.client.zzl.zza (com.google.android.gms:play-services-ads-api@@24.4.0:6)
com.google.android.gms.ads.internal.client.zzas.zzc (com.google.android.gms:play-services-ads-api@@24.4.0:12)
com.google.android.gms.ads.internal.client.zzba.zzf (com.google.android.gms:play-services-ads-api@@24.4.0:1)
com.google.android.gms.ads.internal.client.zzba.zzd (com.google.android.gms:play-services-ads-api@@24.4.0:11)
com.google.android.gms.ads.internal.client.zzaz.zzg (com.google.android.gms:play-services-ads-api@@24.4.0:2)
com.google.android.gms.ads.zzb.zza (com.google.android.gms:play-services-ads-api@@24.4.0:1)
com.google.android.gms.ads.preload.zzb.<init> (com.google.android.gms:play-services-ads-api@@24.4.0:1)
com.google.android.gms.ads.internal.client.zzep.<init> (com.google.android.gms:play-services-ads-api@@24.4.0:1)
com.google.android.gms.ads.internal.client.zzey.zzq (com.google.android.gms:play-services-ads-api@@24.4.0:27)
com.google.android.gms.ads.MobileAds.initialize (com.google.android.gms:play-services-ads-api@@24.4.0:2)

Trigger Condition: App is not in active state for a long time + onTrimMemory called by OS (any trim level)


Possible reproduction Steps:
- Initialize Mobile Ads in application
- Background the app for an extended period
- Wait for system to trigger onTrimMemory
- Crash occurs when system attempts to re-initialize ad components

Mobile Ads SDK Forum Advisor

unread,
Oct 27, 2025, 7:01:36 AM (4 days ago)  Oct 27
to zadorozh...@gmail.com, google-adm...@googlegroups.com
Hi,

Thank you for contacting the Mobile Ads SDK Support team.   

It's always recommended to use the most recent version to avoid conflicts, please ensure you have integrated the latest one. 

I’ve checked our sample application , but I wasn’t able to reproduce the issues you mentioned. Could you please verify if the same behavior occurs in our Google sample app ?  If so, please share the screen recording and your sample project (not the APK) showing the issue.

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 to me or 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=500Ht00001vRpV3IAK&entry.80707362=00336595

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-10-27 11:00:33Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01vRpV3:ref" (ADR-00336595)



Reply all
Reply to author
Forward
0 new messages