Suspicious Camera Usage Leading to ANR in Google Ads SDK

49 views
Skip to first unread message

Bhavesh Solanki

unread,
Jan 9, 2025, 11:35:59 PMJan 9
to Google Mobile Ads SDK Developers

Hi Google Ads SDK Support Team,

We’ve encountered an ANR that appears to originate from the Google Ads SDK. Here are the details of the stack trace:

Our app does not allow or use camera-related functionalities in the ads code or while displaying ads. This behavior looks suspicious, as the ANR seems to be triggered by accessing camera-related APIs.

at androidx.camera.core.imagecapture.TakePictureRequest$$ExternalSyntheticLambda3._V (R8$$SyntheticClass) at org.chromium.content.browser.BrowserStartupControllerImpl.c (chromium-TrichromeWebViewGoogle.aab-stable-677813531:136) at WV.Z5.run (chromium-TrichromeWebViewGoogle.aab-stable-677813531:222) at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:462) at java.util.concurrent.FutureTask.run (FutureTask.java:266) at org.chromium.base.task.PostTask.d (chromium-TrichromeWebViewGoogle.aab-stable-677813531:12) at org.chromium.android_webview.AwBrowserProcess.j (chromium-TrichromeWebViewGoogle.aab-stable-677813531:33) at com.android.webview.chromium.N.e (chromium-TrichromeWebViewGoogle.aab-stable-677813531:217) at com.android.webview.chromium.N.b (chromium-TrichromeWebViewGoogle.aab-stable-677813531:42) at com.android.webview.chromium.N.g (chromium-TrichromeWebViewGoogle.aab-stable-677813531:5) at com.android.webview.chromium.WebViewChromiumFactoryProvider.m (chromium-TrichromeWebViewGoogle.aab-stable-677813531:8) at com.android.webview.chromium.WebViewChromium.init (chromium-TrichromeWebViewGoogle.aab-stable-677813531:97) at android.webkit.WebView.<init> (WebView.java:435) at android.webkit.WebView.<init> (WebView.java:355) at android.webkit.WebView.<init> (WebView.java:337) at android.webkit.WebView.<init> (WebView.java:324) at android.webkit.WebView.<init> (WebView.java:314) at com.google.android.gms.ads.internal.webview.ai.<init> (:com.google.android.gms.policy_ads_fdr_dynamite@244410211@244410203017.691591528.691591528:1)

Could you please:

  1. Investigate and help resolve this ANR?
  2. Share why the Ads SDK is accessing camera-related functionalities?
  3. Let us know if there is a way to notify the SDK not to use specific device hardware functionalities (e.g., camera, location, or other hardware) that are not permitted in our app.

This issue is impacting the stability of our app, and we would greatly appreciate a prompt response with clarification and a potential fix.

Looking forward to your assistance.

Thanks,
Bhavesh

Mobile Ads SDK Forum Advisor

unread,
Jan 10, 2025, 3:28:19 AMJan 10
to google-adm...@googlegroups.com

Hi Bhavesh,

Thank you for contacting the Mobile Ads SDK Support team.

It is always recommended to keep the SDKs up to date to avoid such issues. 

Please note that the best way to optimize initialization is to call MobileAds.initialize() on a background thread, as described in the Get Started guide

Looking at the logs, it appears the ANR is related to WebView init. The WebView init is a heavy task (especially the 1st init call) which unfortunately will occupy the UI thread. The Google Mobile Ads SDK relies on WebView heavily. We would still like to see a minimal reproducible to fully diagnose the issue but at this time we can only recommend lightening the load on the UI thread during app startup, such as delaying tasks until it's necessary to call them. You can also refer to the WebView API.

If the issue still persists, kindly provide the below information privately so we can gain full visibility of your implementation.

  • ad unit ID
  • The full stack trace
  • Steps to replicate (Without any reproducible steps the ANR is not actionable)
  • Affected devices
  • Sample project reproducing the issue if possible

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=5004Q00002vGuveQAC&entry.80707362=00283781

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

Thanks,
 
Google Logo Mobile Ads SDK Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5



Reply all
Reply to author
Forward
0 new messages