Bug: Admob seems to interfere with Android resources, causing "IllegalArgumentException: Wrong state class, expecting View State..."

93 views
Skip to first unread message

Liran Barsisa

unread,
Mar 24, 2025, 10:53:21 PMMar 24
to Google Mobile Ads SDK Developers
I can't be sure about this as it's a very weird issue:

On an app I have, it has a Fragment at the bottom of a settings screen. The Fragment holds ads (native/banner ads).

When I change the orientation it causes this crash:

java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class com.google.android.material.button.MaterialButton$SavedState instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/.... Make sure other views do not use the same id.
If I remove/change various resources and files that have nothing to do with it, the issue is gone.

One way to show it is by changing just the Admob app-ID.

I've demonstrated it here with all files possible (including video, the project itself, bug report, and even IDE files), but for some it got closed very soon after creating the issue.

Please, if it's not Admob, talk with the relevant teams to investigate it. 
I have no way to solve it except the workaround of adding android:saveEnabled="false" to each button that is being affected by it.

Mobile Ads SDK Forum Advisor

unread,
Mar 26, 2025, 9:05:45 AMMar 26
to lbl...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for contacting the Mobile Ads SDK Support team.

Could you kindly share the sample project 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 via reply to author option 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=5004Q00002vHCMcQAO&entry.80707362=00296332

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-03-26 09:04:04Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vHCMc:ref" (ADR-00296332)



Liran Barsisa

unread,
Mar 26, 2025, 2:42:17 PMMar 26
to Google Mobile Ads SDK Developers
OK I've uploaded them together into a zipped file.
Please, if you think it's something else and not Admob, contact the relevant teams to re-open the issue as I've spent a lot of time in finding the trigger to this issue and I can't find a proper solution for it. Only the workaround I've mentioned there works, but it's not a proper solution...

Mobile Ads SDK Forum Advisor

unread,
Mar 26, 2025, 8:39:11 PMMar 26
to lbl...@gmail.com, google-adm...@googlegroups.com

Hi Liran,

Please note that we didn’t receive the files which you have shared, also the files you have attached on bug, we are not able to access it. Could you kindly reshare the files using the link below so we can gain full visibility of your implementation. 

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:

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-03-26 20:38:21Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vHCMc:ref" (ADR-00296332)



Liran Barsisa

unread,
Mar 26, 2025, 8:51:28 PMMar 26
to Google Mobile Ads SDK Developers
OK I've attached via the link again.

Mobile Ads SDK Forum Advisor

unread,
Mar 26, 2025, 11:56:59 PMMar 26
to lbl...@gmail.com, google-adm...@googlegroups.com

Hi,

Kindly ignore the previous response.

We have got access and reviewed your files, after investigation, it appears that the issue is related to an integration problem within your application. We tested the issue in the Google sample project and were unable to replicate it. Could you please confirm whether you can replicate the same issue in our Google Sample Project, If yes then kindly share steps to replicate it and share Google Sample Project replicating this 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 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=5004Q00002vHCMcQAO&entry.80707362=00296332

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-03-26 23:56:11Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vHCMc:ref" (ADR-00296332)



Liran Barsisa

unread,
Mar 27, 2025, 12:11:07 AMMar 27
to Google Mobile Ads SDK Developers
What integration problem? Please be more specific.
Did you reproduce it on what I've provided?
Why do you want to try on a sample project, after I already explained that the smaller the app is, the less chance it gets to be able to reproduce it... What you wrote doesn't make sense, to try on a new, tiny project. I explained that when I tried to minimize the app it didn't reproduce, so of course on a sample app it won't get reproduced. I need it to be as similar to my app as possible. Not the opposite.
I already also explained that I don't know what are the steps to reach it. I just showed that it reached it on the project, and that removing/modifying some files that have nothing to do with the UI that I've explained about, it somehow doesn't get reproduced.

Rana Kashif

unread,
Mar 27, 2025, 12:54:52 AMMar 27
to Liran Barsisa, Google Mobile Ads SDK Developers

what you say i don't understand


--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-admob-ads-sdk/a9dbfdb5-66e7-432c-9658-2323087f208an%40googlegroups.com.

Mobile Ads SDK Forum Advisor

unread,
Apr 2, 2025, 5:15:35 PM (8 days ago) Apr 2
to lbl...@gmail.com, google-adm...@googlegroups.com

Hi,

Examination of the provided sample project has not yielded the root cause of the aforementioned issue. As requested earlier, could you try once in our Google Sample Project and confirm the results? 


Thanks,
 
Google Logo Mobile Ads SDK Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-04-02 17:14:30Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vHCMc:ref" (ADR-00296332)



Liran Barsisa

unread,
Apr 2, 2025, 5:30:54 PM (8 days ago) Apr 2
to Google Mobile Ads SDK Developers
Have you succeeded to reproduce the issue?
As I've mentioned above, the more I remove from the project, the more chance the issue won't be reproduced. 
Thus, using the sample can't be a possible direction to investigate it, as I don't know what you want me to do with the sample. You didn't even mention which sample and what to change in it...

Mobile Ads SDK Forum Advisor

unread,
Apr 2, 2025, 11:37:53 PM (8 days ago) Apr 2
to lbl...@gmail.com, google-adm...@googlegroups.com

Hi Liran,

We are able to replicate the issue and I will share this to the wider team 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-04-02 23:36:13Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vHCMc:ref" (ADR-00296332)



Mobile Ads SDK Forum Advisor

unread,
Apr 8, 2025, 11:11:54 PM (2 days ago) Apr 8
to google-adm...@googlegroups.com, lbl...@gmail.com

Hi Liran,

I ran the sample project which you’ve shared and was able to reproduce the crash upon device rotation while a banner ad was being displayed. I’ve seen the logs and based on the log, none of the error messages originated from the Google Mobile Ads SDK (identified by the "com.google.android.gms.ads" symbol), indicating an implementation issue rather than an SDK problem. 

You should ensure that every view within the same layout hierarchy has a unique ID. Specifically, you need to identify where the ID id/fragment_ad__noAdsAlternativeBannerButton is being used and ensure it is assigned to only one view within any given layout (for both portrait and landscape orientations).

Thanks,
 
Google Logo Mobile Ads SDK Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-04-08 23:10:48Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vHCMc:ref" (ADR-00296332)



Mobile Ads SDK Forum Advisor

unread,
Apr 9, 2025, 5:08:28 AM (yesterday) Apr 9
to lbl...@gmail.com, google-adm...@googlegroups.com
Hi Liran,

Thank you for sending the logs. I will pass this information to the team and update you once I have more information. 

Thanks,
 
Google Logo Mobile Ads SDK Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-04-09 05:07:09Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vHCMc:ref" (ADR-00296332)



Reply all
Reply to author
Forward
0 new messages