Still Facing ANRs in 24.3.0 and UI freeze when initialize google ad mob sdk in android and also while calling loadAd().

363 views
Skip to first unread message

Karan Thakkar

unread,
Jun 3, 2025, 7:41:10 PM Jun 3
to Google Mobile Ads SDK Developers
I am using the latest version of the sdk 24.3.0 but there is still a significant UI freeze when we call initialize from main or background thread and also when calling loadAd from main thread, please can anyone tell me the fix for this, we are getting multiple ANR and our app performance is drastically reducing. 

Mobile Ads SDK Forum Advisor

unread,
Jun 4, 2025, 7:07:21 AM Jun 4
to kar...@digimonksolutions.com, google-adm...@googlegroups.com

Hi,

Thank you for contacting the Mobile Ads SDK support team.

Please utilize the optimize initialization parameter and also please refer to the Initialize the Google Mobile Ads SDK and call the initialize() method on a background thread within an Activity.

If the issue still persists, share your sample project (not the apk file) where the issue is reproducible.Additionally, could you provide the ANR logs 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=500Ht00001reD12IAE&entry.80707362=00309884

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-06-04 11:06:34Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01reD12:ref" (ADR-00309884)



Karan Thakkar

unread,
Jun 5, 2025, 5:39:14 PM Jun 5
to Google Mobile Ads SDK Developers
We can see a significant lag when we call LoadAd() function provied by the SDK on main thread as suggested in doc, we have also added all the optimization code in the menifest.

I have also attached multiple stack traces from play console all different but all related to sdk

If you want to repo this issue just call loadAD function on a button click while show a loading indicator in the background, when you will click the button you will notice the progress indicator lag for a second when load ad function is called. I have also check using profiler and your adWorker taking a lot of cpu when called loadAd()
stacktrace (2).log
stacktrace.log
stacktrace (1).log

Mobile Ads SDK Forum Advisor

unread,
Jun 6, 2025, 12:52:39 AM Jun 6
to kar...@digimonksolutions.com, google-adm...@googlegroups.com

Hi,

Thank you for getting back to us. 

I tested the scenario you described—invoking the loadAd function on the main thread triggered by a button click, along with displaying a progress loader in our Google Sample Project. However, I was unable to reproduce the UI lag issue.

Could you please confirm if this behavior is observed on any specific Android device models or OS versions? Additionally, if possible, could you try replicating the same steps in Google Sample Project . If you're still facing the issue, kindly share your sample project privately 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 us 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=500Ht00001reD12IAE&entry.80707362=00309884

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-06-06 04:51:33Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01reD12:ref" (ADR-00309884)



Karan Thakkar

unread,
Jun 10, 2025, 2:39:41 AM Jun 10
to Google Mobile Ads SDK Developers
Hey,

I have uploaded a demo app with the same structure as our live app in the private form with case id: 500Ht00001reD12IAE

I have attached the strict model logs, profiler result and device info in with anr is happening

I am calling LoadAD() when navigating from splash screen and in the next screen there are some animation, you can see significant lags in lower end devices when load AD is called before navigation, if you remove the ad load code the animation works just fine.

Mobile Ads SDK Forum Advisor

unread,
Jun 10, 2025, 7:42:31 AM Jun 10
to kar...@digimonksolutions.com, google-adm...@googlegroups.com

Hi,
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. In the meantime, your patience is greatly appreciated.As a suggestion, you may consider providing an activity context to MobileAds.initialize()—as recommended in the developer documentation —as this should prevent the StrictMode violation log from appearing.

Thanks,
Google Logo
Mobile Ads SDK Team

Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-06-10 11:41:41Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01reD12:ref" (ADR-00309884)



Karan Thakkar

unread,
Jun 10, 2025, 9:07:02 AM Jun 10
to Google Mobile Ads SDK Developers
Penalty logs are not the issue, its just for you help, the main issue is with the junky frame and freezing UI when called loadAD(), please check that and let me know for any improvements
This code structure represent  the same as our live app so it will help with our live app if you provide any other suggestions

The main reason of initializing SDK in application class is because I have to load app open ads as well, I am loading app open ad in our live app ( not in demo )  to show ad before the main activity, if I don't do this then when the app cold start it will not show the app open ad for the first time.

Karan Thakkar

unread,
Jun 12, 2025, 3:35:23 AM Jun 12
to Google Mobile Ads SDK Developers
Can I get an update on this, are you guys able to repo the issue or the issue is from our side, can you give some insights please, we are waiting for this to be fixed we are getting a lot of ANRs from AD Mob, if you think that its SDK please let me know as well so we can insure and wait for the fix.

Mobile Ads SDK Forum Advisor

unread,
Jun 12, 2025, 11:04:45 AM Jun 12
to kar...@digimonksolutions.com, google-adm...@googlegroups.com
Hello Karan,

Thanks for bumping the thread.

We are currently looking into the issue you encountered.

I have a few follow-up questions:

  • Did you encounter the ANRs only in v24.3.0? Have you tested with previous versions to see if that removes or alleviates the issue?
  • Did you encounter the ANRs only on the Samsung Galaxy M21 device? Since our team wasn't able to reproduce the issue with a Google Pixel 6A and an Emulator Pixel 9 Pro, can you provide a list of devices that are impacted?
  • Did turning on/off strict mode on your end make a difference?
  • Did the issue happen only with banner ads?

Thank you!



Thanks,
Google Logo
Joshua
Mobile Ads SDK Team


Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-06-12 15:03:56Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01reD12:ref" (ADR-00309884)



Karan Thakkar

unread,
Jun 17, 2025, 2:30:30 AM Jun 17
to Google Mobile Ads SDK Developers
  • Did you encounter the ANRs only in v24.3.0? Have you tested with previous versions to see if that removes or alleviates the issue?
  • > Yes, I have tested multiple version but all have same issue.

  • Did you encounter the ANRs only on the Samsung Galaxy M21 device? Since our team wasn't able to reproduce the issue with a Google Pixel 6A and an Emulator Pixel 9 Pro, can you provide a list of devices that are impacted?
  • > Mostly on lower end device and samsung lower end devices.
  • Did turning on/off strict mode on your end make a difference?
  • > No, strict mode was just to show the thread logs, it's still gives anr without strict mode enabled.

  • Did the issue happen only with banner ads?
  • > You can check my demo project that I have provided, In the demo I am loading native ads, but in my production app I am loading native as well as app open ads which make the device lag even more. we don't have banner ads in the app.

Mobile Ads SDK Forum Advisor

unread,
Jun 20, 2025, 2:08:49 AM Jun 20
to kar...@digimonksolutions.com, google-adm...@googlegroups.com
Hello Karan,

Thank you for the clarifications.

We are currently investigating the issue and will get back to you as soon as possible.


Thanks,
Google Logo
Joshua
Mobile Ads SDK Team


Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-06-20 06:07:51Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01reD12:ref" (ADR-00309884)



Mobile Ads SDK Forum Advisor

unread,
Jun 23, 2025, 7:17:42 PM Jun 23
to kar...@digimonksolutions.com, google-adm...@googlegroups.com
Hello Karan,

Thank you for your patience.

Based on the provided stack trace, the primary cause of the reported issues appears to be the Google Mobile Ads SDK attempting to perform UI-related operations using a non-UI Context.

Could you confirm whether a proper Activity context is being passed when rendering the interstitial ads?


Thanks,
Google Logo
Joshua
Mobile Ads SDK Team


Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-06-23 23:16:45Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01reD12:ref" (ADR-00309884)



Frank King

unread,
Jun 23, 2025, 10:18:17 PM Jun 23
to Google Mobile Ads SDK Developers
I am also experiencing a similar issue with Google AdMob. I have multiple fragments in my app and when I enter the fragment that contains the ad, it causes a lag spike and when I go to other fragments inside my project, many of the views within them have disappeared. I have noticed that it has something to do with when I call MobileAds.initialize() inside MainActivity.java.

Mobile Ads SDK Forum Advisor

unread,
Jun 25, 2025, 7:25:55 PM Jun 25
to frank...@gmail.com, google-adm...@googlegroups.com
Hello Frank,

Thanks for reporting the issue.

Did you initialize the Google Mobile Ads SDK on a background thread?

Can you provide the stack trace for all threads, along with your implementation code/project? Without that information, we aren't able to determine the cause.

You can choose to reply privately.



Thanks,
Google Logo
Joshua
Mobile Ads SDK Team


Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-06-25 23:25:11Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01reD12:ref" (ADR-00309884)



Karan Thakkar

unread,
Jul 1, 2025, 1:01:21 PM Jul 1
to Google Mobile Ads SDK Developers
I have already sent you a demo app, you can check in that.

Mobile Ads SDK Forum Advisor

unread,
Jul 8, 2025, 4:29:56 PM Jul 8
to kar...@digimonksolutions.com, google-adm...@googlegroups.com
Hello Karan,

Looking again at the stack trace you provided previously, none of them seem to be related to an ANR caused by loading an ad; they only show the Strict Mode violations.

Below is the Strict Mode violation message. If you were to turn off Strict Mode, these messages would no longer appear:

```
java.lang.IllegalAccessException: Tried to access the API:ViewConfiguration which needs to have proper configuration from a non-UI Context:com.google.android.gms.internal.ads.zzcgu@c8966e2
    at android.os.StrictMode.assertConfigurationContext(StrictMode.java:2296)
    at android.view.ViewConfiguration.get(ViewConfiguration.java:531)
    at android.view.View.initScrollCache(View.java:7201)
    at android.view.View.initializeScrollbarsInternal(View.java:7010)
    at android.view.View.<init>(View.java:6398)
    at android.view.ViewGroup.<init>(ViewGroup.java:720)
    at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:58)
    at android.webkit.WebView.<init>(WebView.java:423)
    at android.webkit.WebView.<init>(WebView.java:365)
    at android.webkit.WebView.<init>(WebView.java:347)
    at android.webkit.WebView.<init>(WebView.java:334)
    at android.webkit.WebView.<init>(WebView.java:324)
    at com.google.android.gms.internal.ads.zzcga.<init>(com.google.android.gms:play-services-ads@@24.3.0:1)
    at com.google.android.gms.internal.ads.zzcfm.zza(com.google.android.gms:play-services-ads@@24.3.0:4)
    at com.google.android.gms.internal.ads.zzcfo.zza(com.google.android.gms:play-services-ads@@24.3.0:8)
    at com.google.android.gms.internal.ads.zzdpd.zza(com.google.android.gms:play-services-ads@@24.3.0:2)
    at com.google.android.gms.internal.ads.zzefd.zzc(com.google.android.gms:play-services-ads@@24.3.0:8)
    at com.google.android.gms.internal.ads.zzeey.zza(Unknown Source:8)
    at com.google.android.gms.internal.ads.zzgbt.zze(com.google.android.gms:play-services-ads@@24.3.0:2)
    at com.google.android.gms.internal.ads.zzgbv.run(com.google.android.gms:play-services-ads@@24.3.0:8)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.google.android.gms.internal.ads.zzfrl.zza(com.google.android.gms:play-services-ads-api@@24.3.0:1)
    at com.google.android.gms.ads.internal.util.zzf.zza(com.google.android.gms:play-services-ads@@24.3.0:1)
    at com.google.android.gms.internal.ads.zzfrl.dispatchMessage(com.google.android.gms:play-services-ads-api@@24.3.0:1)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8751)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
```

The reason for the above exception is that the Google Mobile Ads SDK is using the application context when creating a WebView, while WebView documentation recommends using an Activity context for its creation. Therefore, this behavior is working as intended.

Are you able to provide a stack trace that does indicate ad loading is causing an ANR instead?


Thanks,
Google Logo
Joshua
Mobile Ads SDK Team


Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-07-08 20:28:57Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01reD12:ref" (ADR-00309884)



Karan Thakkar

unread,
Aug 13, 2025, 10:31:30 AM Aug 13
to Google Mobile Ads SDK Developers

I am still getting multiple ANR in my product version on play store, I have even initialize the sdk in Main Activity but I am still receiving the ANRs, you guys only seem to say that its not reproducing. I am literally providing all the stack traces from play console, I have even create a demo for you which clearly show lag in UI when loading ads in lower end devices. Google is not prompting my app just because I have high ANR rate just because of this SDK, Please fix this issue or provide me a better solution.


I have attached my recent stack trace from current live version, the app has native ads, app open ad and reward ads. AND I HAVE INITIALIZED THE SDK IN MAIN ACTIVITY SO DON"T GIVE ME THIS SOLUTION!!!    
stacktrace (3).log
stacktrace (4).log
stacktrace (5).log

Mobile Ads SDK Forum Advisor

unread,
Aug 14, 2025, 10:02:07 PM Aug 14
to kar...@digimonksolutions.com, google-adm...@googlegroups.com
Hello Karan,

Reason of ANR
The ANR is triggered because the main thread becomes unresponsive. The stack traces indicate that the ANR occurred during the process of creating a WebView client and initializing a new WebView, both initiated by the Google Mobile Ads SDK. This heavy and synchronous operation runs on the main thread, thereby blocking it.

Since the SDK relies on WebView to serve ads, and the ANR related to WebView initialization is beyond the direct control of the Google Mobile Ads SDK, one possible option to alleviate this is for the app to attempt initializing the WebView beforehand (when the app is not performing UI-heavy tasks).

How to alleviate ANR caused by WebView creation
There isn't a specific recommendation for which activity's lifecycle MobileAds.initialize() should be called, as implementations and UI thread usage patterns vary significantly across applications.

What publishers can do is to either call MobileAds.initialize() within an activity that involves fewer critical UI operations, or, more broadly, to arrange the initialization operation so that it does not block the UI thread and user interactions.


Thanks,
Google Logo
Joshua
Mobile Ads SDK Team


Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-08-15 02:01:03Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01reD12:ref" (ADR-00309884)



XuanNV

unread,
Aug 28, 2025, 8:21:20 AM (10 days ago)  Aug 28
to Google Mobile Ads SDK Developers
I'd like to clarify something about the ANR issue. To help reduce these ANR, should I pass the application context to MobileAds.initialize() within an activity, or is it necessary to use the activity reference?
Vào lúc 09:02:07 UTC+7 ngày Thứ Sáu, 15 tháng 8, 2025, Mobile Ads SDK Forum Advisor đã viết:

Mobile Ads SDK Forum Advisor

unread,
Sep 2, 2025, 12:51:16 PM (5 days ago)  Sep 2
to nvx.ct...@gmail.com, google-adm...@googlegroups.com
Hello Xuan,

Thank you for your question.

Using either the application context or an activity context to initialize the Google Mobile Ads SDK should not directly cause ANRs.

In our example apps , we use the activity context to initialize the SDK. However, the SDK internally uses the application context when creating a WebView.

Please let us know if you encounter any errors.


Thanks,
Google Logo
Joshua
Mobile Ads SDK Team


Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-09-02 16:50:27Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01reD12:ref" (ADR-00309884)



Reply all
Reply to author
Forward
0 new messages