AdMob: MobileAds.initialize() - "java.lang.Integer cannot be cast to java.lang.String"

1,758 views
Skip to first unread message

anonym

unread,
Mar 19, 2024, 3:16:21 PM3/19/24
to Google Mobile Ads SDK Developers
Recently I noticed some crashes for my app by looking at Firebase Crashlytics which seems to be related to Google AdMob library which tries to use `SharedPreferences` but it fails to get some preferences because of cast exception:

8vPWr.png
LoiWM.png

Code text:

    Fatal Exception: java.lang.ClassCastException
    java.lang.Integer cannot be cast to java.lang.String
    android.app.SharedPreferencesImpl.getString (SharedPreferencesImpl.java:302)
    com.google.android.gms.ads.internal.scionintegration.a.onSharedPreferenceChanged (:com.google.android.gms.policy_ads_fdr_dynamite@240304709@240304704034.602821767.602821767:73)
    com.google.android.gms.ads.internal.scionintegration.m.a (:com.google.android.gms.policy_ads_fdr_dynamite@240304709@240304704034.602821767.602821767:106)
    com.google.android.gms.ads.nonagon.a.s (:com.google.android.gms.policy_ads_fdr_dynamite@240304709@240304704034.602821767.602821767:439)
    com.google.android.gms.ads.nonagon.a.b (:com.google.android.gms.policy_ads_fdr_dynamite@240304709@240304704034.602821767.602821767:5)
    com.google.android.gms.ads.ChimeraMobileAdsSettingManagerCreatorImpl.getMobileAdsSettingManager (:com.google.android.gms.policy_ads_fdr_dynamite@240304709@240304704034.602821767.602821767:52)
    com.google.android.gms.ads.internal.client.bx.bR (:com.google.android.gms.policy_ads_fdr_dynamite@240304709@240304704034.602821767.602821767:40)
    m.ajn.onTransact (:com.google.android.gms.policy_ads_fdr_dynamite@240304709@240304704034.602821767.602821767:21)
    android.os.Binder.transact (Binder.java:1173)
    obj.gL (:com.google.android.gms@240713038@24.07.13 (190400-607434947):8)
    com.google.android.gms.ads.internal.client.ay.getMobileAdsSettingManager (:com.google.android.gms@240713038@24.07.13 (190400-607434947):12)
    com.google.android.gms.ads.MobileAdsSettingManagerCreatorImpl.getMobileAdsSettingManager (:com.google.android.gms@240713038@24.07.13 (190400-607434947):42)
    com.google.android.gms.ads.internal.client.az.fL (:com.google.android.gms@240713038@24.07.13 (190400-607434947):40)
    obk.onTransact (:com.google.android.gms@240713038@24.07.13 (190400-607434947):101)
    android.os.Binder.transact (Binder.java:1173)
    com.google.android.gms.internal.ads.zzavg.zzbh (com.google.android.gms:play-services-ads-base@@22.6.0:1)
    com.google.android.gms.ads.internal.client.zzcp.zze (zzcp.java:169)
    com.google.android.gms.ads.internal.client.zzeq.zza (zzeq.java:169)
    com.google.android.gms.ads.internal.client.zzaq.zzc (com.google.android.gms:play-services-ads-lite@@22.6.0:169)
    com.google.android.gms.ads.internal.client.zzax.zzf (com.google.android.gms:play-services-ads-lite@@22.6.0:126)
    com.google.android.gms.ads.internal.client.zzax.zzd (com.google.android.gms:play-services-ads-lite@@22.6.0:126)
    com.google.android.gms.ads.internal.client.zzej.zzA (com.google.android.gms:play-services-ads-lite@@22.6.0:17)
    com.google.android.gms.ads.internal.client.zzej.zzm (zzej.java:53)
    com.google.android.gms.ads.MobileAds.initialize (com.google.android.gms:play-services-ads-lite@@22.6.0:53)
    com.MY_APP_PACKAGE.ads.AdMob.initAdmob (AdMob.kt:128)

I have other apps which use 22.6.0 version of Admob and I didn't notice such crashes for them and for this app it happened only for 6 users (of ~230k users) but still... why it could happen..

Mobile Ads SDK Forum Advisor

unread,
Mar 19, 2024, 5:31:16 PM3/19/24
to 8he...@gmail.com, google-adm...@googlegroups.com

Hi, 

Thank you for contacting Google Mobile Ads SDK support team.

The logs which you have shared are indicating that the issue might have occurred due to mismatch of data types while storing Shared preference class variable. As we cannot further proceed with limited information, Could you please provide more information regarding the crash? and kindly share a sample project that is actually replicating the issue or a Charles log session recording. As this issue is rarely reproducible kindly share the effected devices details, Charles session recording would be very helpful for further investigation.
 

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=5004Q00002s04OfQAI&entry.80707362=00227888

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.!5004Q02s04gj:ref" (ADR-00227901)

Thanks,
 
Google Logo Mobile Ads SDK Team


Nomad88

unread,
Mar 19, 2024, 7:22:46 PM3/19/24
to Google Mobile Ads SDK Developers
Hey Mobile Ads SDK Team,

This issue is causing crash to lots of apps.
This is not a implementation issue, it must be an server-side issue or an issue from the Play Services library update.

The following links are posts about the issue posted in a few hours:


Please note that this issue is breaking many apps.

Best,
Heejin

Sentry Apps

unread,
Mar 19, 2024, 8:29:55 PM3/19/24
to Google Mobile Ads SDK Developers
This needs to be escalated ASAP. 1000s of crashes last several hours due to this `MobileAds.initialize()` issue.

Simon Marquis

unread,
Mar 19, 2024, 8:55:53 PM3/19/24
to Google Mobile Ads SDK Developers
I've also reported the same issue here: https://issuetracker.google.com/issues/330368298
Hopefully they can remotely fix the issue. Forcing all users to update to a new version is definitely not an acceptable solution.

hberb...@gmail.com

unread,
Mar 20, 2024, 1:51:43 AM3/20/24
to Google Mobile Ads SDK Developers
Same here, our app got 5500 crashes last 24 hours because of this casting error. It started around 12 hours ago.

20 Mart 2024 Çarşamba tarihinde saat 03:55:53 UTC+3 itibarıyla Simon Marquis şunları yazdı:

Mobile Ads SDK Forum Advisor

unread,
Mar 20, 2024, 2:21:10 AM3/20/24
to sentr...@gmail.com, google-adm...@googlegroups.com

Hi,

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

Mobile Ads SDK Forum Advisor

unread,
Mar 20, 2024, 2:31:44 AM3/20/24
to simon.m...@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 query and one of my team members will reach out to you once we have an update on this. Meanwhile, your patience is highly appreciated.

This message is in relation to case "ref:!00D1U01174p.!5004Q02s05DO:ref" (ADR-00227942)


Thanks,
 
Google Logo Mobile Ads SDK Team


Mobile Ads SDK Forum Advisor

unread,
Mar 20, 2024, 2:34:34 AM3/20/24
to hberb...@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 query and one of my team members will reach out to you once we have an update on this. Meanwhile, your patience is highly appreciated.

This message is in relation to case "ref:!00D1U01174p.!5004Q02s05Tb:ref" (ADR-00227957)


Thanks,
 
Google Logo Mobile Ads SDK Team


Dmitry

unread,
Mar 20, 2024, 2:40:08 AM3/20/24
to Google Mobile Ads SDK Developers
Same issue here. All games at once. It is certainly caused by a staged release of your new Google Play Services (((

Steirersoft

unread,
Mar 20, 2024, 2:46:03 AM3/20/24
to Google Mobile Ads SDK Developers
Same issue here

Tomáš Kuba

unread,
Mar 20, 2024, 2:49:52 AM3/20/24
to Google Mobile Ads SDK Developers
Same issue here. Please solve ASAP.

potkan...@gmail.com

unread,
Mar 20, 2024, 2:57:16 AM3/20/24
to Google Mobile Ads SDK Developers
Same for us. Started yesterday evening (Central European Time) and is happening since then on all our apps. Thousands of crashes.

Dátum: streda 20. marca 2024, čas: 7:49:52 UTC+1, odosielateľ: Tomáš Kuba

Henrik Hagström

unread,
Mar 20, 2024, 3:19:24 AM3/20/24
to Google Mobile Ads SDK Developers
I got the same crash

Nomad88

unread,
Mar 20, 2024, 3:22:26 AM3/20/24
to Google Mobile Ads SDK Developers

It looks like the issue is being resolved, but it will likely take some time to be fully resolved.

Akshay Vadchhak

unread,
Mar 21, 2024, 5:38:39 AM3/21/24
to Google Mobile Ads SDK Developers
Still, we are getting same issues.

shubham rampurkar

unread,
Mar 21, 2024, 6:14:23 AM3/21/24
to Google Mobile Ads SDK Developers
Same here.

Mobile Ads SDK Forum Advisor

unread,
Mar 21, 2024, 9:58:33 AM3/21/24
to shubhamr...@gmail.com, google-adm...@googlegroups.com

Hi,

Your inquiry is currently undergoing investigation, and we'll keep you posted as soon as we have something to share. However, please be assured that our team is actively working on the matter. We appreciate your understanding and patience.

netl...@gmail.com

unread,
Mar 22, 2024, 7:06:16 AM3/22/24
to Google Mobile Ads SDK Developers
Same here, a lot of users experienced crashes and gave us many bad reviews.

Mobile Ads SDK Forum Advisor

unread,
Apr 1, 2024, 4:31:56 PM4/1/24
to google-adm...@googlegroups.com, sentr...@gmail.com
Hi,

This issue has been resolved by AdMob team, kindly check it.
Thanks!

Mobile Ads SDK Forum Advisor

unread,
Apr 1, 2024, 4:37:51 PM4/1/24
to simon.m...@gmail.com, google-adm...@googlegroups.com

Hi,

This issue has been resolved by AdMob team, kindly check it.

Thanks!
 

This message is in relation to case "ref:!00D1U01174p.!5004Q02s05DO:ref" (ADR-00227942)


Thanks,
 
Google Logo Mobile Ads SDK Team


Mobile Ads SDK Forum Advisor

unread,
Apr 1, 2024, 4:38:29 PM4/1/24
to netl...@gmail.com, google-adm...@googlegroups.com

Hi,

This issue has been resolved by AdMob team, kindly check it.

Thanks!
 

This message is in relation to case "ref:!00D1U01174p.!5004Q02s05Tb:ref" (ADR-00227957)


Thanks,
 
Google Logo Mobile Ads SDK Team


Sentry Apps

unread,
Apr 2, 2024, 2:59:49 PM4/2/24
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com
What steps is AdMob taking to ensure this doesn't happen again? Surely the BILLIONS of crashes this caused Android apps cannot just be swept under the rug... the SDK being updated to prevent similar issues again with the API will hopefully be one such step.

Sigh.
Reply all
Reply to author
Forward
0 new messages