Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

ANR "Input dispatching timed out" in Google Play Console. How to identify the problem?

Discussion in 'Android' started by Nolex, Oct 6, 2020.

  1. Nolex

    Nolex

    Joined:
    Dec 10, 2010
    Posts:
    115
    Hi!

    After updating the game, the number of ANRs in my game increased.

    In the update, I updated the versions of the SDK ad networks and also added a new type of ad - BANNER (admob).

    ANR (application not responding):

    Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 7. Wait queue head age: 10593.3ms.)
    com.unity3d.player.UnityPlayerActivity

    anr_1.jpg anr_2.jpg anr_3.jpg

    LOGS:

    Code (CSharp):
    1. Today, 1:01 PM on app version 913
    2. DEXP BS650 (BS650), 1024MB RAM, Android 8.1
    3. Report 1
    4.  
    5. "main" tid=1 Blocked
    6. "main" prio=5 tid=1 Blocked
    7.   | group="main" sCount=1 dsCount=0 flags=1 obj=0x71ed43a0 self=0xa38cf000
    8.   | sysTid=23797 nice=-10 cgrp=default sched=0/0 handle=0xa77274a8
    9.   | state=S schedstat=( 951448643 492572121 2700 ) utm=53 stm=42 core=1 HZ=100
    10.   | stack=0xbe171000-0xbe173000 stackSize=8MB
    11.   | held mutexes=
    12.   at android.webkit.WebViewFactory.getProvider (WebViewFactory.java:191)
    13. - waiting to lock <0x0e00d1b3> (a java.lang.Object) held by thread 59
    14.   at android.webkit.WebView.getFactory (WebView.java:2530)
    15.   at android.webkit.WebView.ensureProviderCreated (WebView.java:2525)
    16.   at android.webkit.WebView.setOverScrollMode (WebView.java:2590)
    17.   at android.view.View.<init> (View.java:4588)
    18.   at android.view.View.<init> (View.java:4721)
    19.   at android.view.ViewGroup.<init> (ViewGroup.java:598)
    20.   at android.widget.AbsoluteLayout.<init> (AbsoluteLayout.java:55)
    21.   at android.webkit.WebView.<init> (WebView.java:643)
    22.   at android.webkit.WebView.<init> (WebView.java:588)
    23.   at android.webkit.WebView.<init> (WebView.java:571)
    24.   at android.webkit.WebView.<init> (WebView.java:558)
    25.   at android.webkit.WebView.<init> (WebView.java:548)
    26.   at com.google.android.gms.ads.internal.webview.ac.<init> (com.google.android.gms.policy_ads_fdr_dynamite@22060002@22060002.318333930.318333930:1)
    27.   at com.google.android.gms.ads.internal.webview.s.a (unavailable)
    28.   at com.google.android.gms.ads.internal.util.bm.a (com.google.android.gms.policy_ads_fdr_dynamite@22060002@22060002.318333930.318333930:13)
    29.   at com.google.android.gms.ads.internal.webview.v.a (com.google.android.gms.policy_ads_fdr_dynamite@22060002@22060002.318333930.318333930:6)
    30.   at com.google.android.gms.ads.internal.js.w.<init> (com.google.android.gms.policy_ads_fdr_dynamite@22060002@22060002.318333930.318333930:4)
    31.   at com.google.android.gms.ads.internal.js.y.run (unavailable)
    32.   at android.os.Handler.handleCallback (Handler.java:790)
    33.   at android.os.Handler.dispatchMessage (Handler.java:99)
    34.   at qp.a (com.google.android.gms.policy_ads_fdr_dynamite@22060002@22060002.318333930.318333930)
    35.   at com.google.android.gms.ads.internal.util.f.a (com.google.android.gms.policy_ads_fdr_dynamite@22060002@22060002.318333930.318333930:1)
    36.   at qp.dispatchMessage (com.google.android.gms.policy_ads_fdr_dynamite@22060002@22060002.318333930.318333930)
    37.   at android.os.Looper.loop (Looper.java:164)
    38.   at android.app.ActivityThread.main (ActivityThread.java:6719)
    39.   at java.lang.reflect.Method.invoke (Native method)
    40.   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:449)
    41.   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)

    I noticed the line "..at qp.a (com.google.android.gms.policy_ads_fdr_dynamite.." in the logs. I think the problem might be Google Admob.. But I'm not sure. And if so, what exactly is the problem? Interstitial/Rewarded? Or Banner?

    FULL Logs: https://pastebin.com/LyPACK2n

    SDK Versions:
    AppLovin MAX: 3.1.0 (Android 9.14.1)
    Google Admob: 19.4.0.0
    Facebook: 6.0.0.1
    UnityAds: 3.4.8.2
    Vungle: 6.7.1.2
    InMobi: 9.0.9.2

    Unity 2019.2.12f
    Target SDK API - 28

    Thanks.
     
    Last edited: Oct 6, 2020
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,875
    You have a deadlock in UI thread, and input is dispatched to UI thread, since input couldn't be processed you got a message about it.

    As for deadlock itself, it's clearly visible in your thread dump.

    ```
    - locked <0x0e00d1b3> (a java.lang.Object)
    ```
    was locked on thread "TIM-gq-AD"

    "main" thread tried to access same object
    ```
    - waiting to lock <0x0e00d1b3> (a java.lang.Object) held by thread 59
    ```

    but couldn't acquire the lock on that object, thus deadlock occured.

    Hope that helps a bit, maybe an error in Admob?
     
    Mr-Cooper, SweatyChair and Nolex like this.
  3. Nolex

    Nolex

    Joined:
    Dec 10, 2010
    Posts:
    115
    @Tomas1856, Thanks for the quick reply!

    Yes, Maybe in Admob...
    Or maybe InMobi (I see the line "..at com.inmobi.media.go.g.." in "TIM-gq-AD").

    Damn, all is uncertain. :)
     
  4. Rocklio

    Rocklio

    Joined:
    Jun 25, 2017
    Posts:
    26
    just stumbled across this thread, my game has a very similar ANR log as well! And also most ANR come from Huawei Y5 Lite
     
    Last edited: Oct 29, 2020
    Nolex likes this.
  5. hlongvu

    hlongvu

    Joined:
    Apr 16, 2019
    Posts:
    5
    I have the same problem.

    Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 56. Wait queue head age: 8512.0ms.)

    #00 pc 0000000000018cc4 /system/lib/libc.so (syscall+28)
    #00 pc 00000000000b71cd /system/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+80)
    #00 pc 00000000003e0911 /system/lib/libart.so (art::GoToRunnable(art::Thread*)+300)
    #00 pc 00000000003e07b5 /system/lib/libart.so (art::JniMethodEnd(unsigned int, art::Thread*)+8)
    #00 pc 0000000000773b31 /system/framework/arm/boot-framework.oat (Java_android_os_BinderProxy_transactNative__ILandroid_os_Parcel_2Landroid_os_Parcel_2I+144)
    at android.os.BinderProxy.transactNative (Native method)
    at android.os.BinderProxy.transact (Binder.java:778)
    at android.app.INotificationManager$Stub$Proxy.createNotificationChannels (INotificationManager.java:1616)
    at android.app.NotificationManager.createNotificationChannels (NotificationManager.java:464)
    at android.app.NotificationManager.createNotificationChannel (NotificationManager.java:452)
    at com.google.android.gms.ads.nonagon.a.a (com.google.android.gms.policy_ads_fdr_dynamite@203404601@203404601003.333818716.333818716:20)
    at com.google.android.gms.ads.nonagon.a.a (com.google.android.gms.policy_ads_fdr_dynamite@203404601@203404601003.333818716.333818716:36)
    at com.google.android.gms.ads.nonagon.shim.v.<init> (com.google.android.gms.policy_ads_fdr_dynamite@203404601@203404601003.333818716.333818716:3)
    at com.google.android.gms.ads.ChimeraAdManagerCreatorImpl.newAdManagerByType (com.google.android.gms.policy_ads_fdr_dynamite@203404601@203404601003.333818716.333818716:11)
    at com.google.android.gms.ads.internal.client.aw.a (com.google.android.gms.policy_ads_fdr_dynamite@203404601@203404601003.333818716.333818716:7)
    at gg.onTransact (com.google.android.gms.policy_ads_fdr_dynamite@203404601@203404601003.333818716.333818716:4)
    at android.os.Binder.transact (Binder.java:627)
    at cok.a (com.google.android.gms@203915063@20.39.15 (110306-335085812):2)
    at com.google.android.gms.ads.internal.client.l.newAdManagerByType (com.google.android.gms@203915063@20.39.15 (110306-335085812))
    at com.google.android.gms.ads.AdManagerCreatorImpl.newAdManagerByType (com.google.android.gms@203915063@20.39.15 (110306-335085812):6)
    at com.google.android.gms.ads.internal.client.m.a (com.google.android.gms@203915063@20.39.15 (110306-335085812):7)
    at col.onTransact (com.google.android.gms@203915063@20.39.15 (110306-335085812):11)
    at android.os.Binder.transact (Binder.java:627)
    at com.google.android.gms.internal.ads.zzgu.transactAndReadException
    at com.google.android.gms.internal.ads.zzxg.zza
    at com.google.android.gms.internal.ads.zzve.zza
    at com.google.android.gms.internal.ads.zzvw.zzpq
    at com.google.android.gms.internal.ads.zzwn.zzqe
    at com.google.android.gms.internal.ads.zzwn.zzd
    at com.google.android.gms.internal.ads.zzyy.zza
    at com.google.android.gms.ads.BaseAdView.loadAd
    at com.google.android.gms.ads.AdView.loadAd
    at com.google.unity.ads.Banner$6.run (Banner.java:305)
    at android.os.Handler.handleCallback (Handler.java:795)
    at android.os.Handler.dispatchMessage (Handler.java:99)
    at android.os.Looper.loop (Looper.java:166)
    at android.app.ActivityThread.main (ActivityThread.java:6861)
    at java.lang.reflect.Method.invoke (Native method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:450)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936)


    And mostly happen with android 8.1. I assume this ANR comes from Admob SDK, which I had updated to the newest version. Anyone have solution yet?
     
    leandrovtd likes this.
  6. leandrovtd

    leandrovtd

    Joined:
    Mar 8, 2017
    Posts:
    28
    Same issue here :(

    I have seen several developers with this problem. Massively in android 8.1.
     
  7. C-kaymakci

    C-kaymakci

    Joined:
    Jan 21, 2015
    Posts:
    2
    Hi all,

    did you solve this problem? I have same issue on Google Pixel 3a.

    SDK Versions:
    AppLovin MAX: 3.1.17 (Android 9.14.1)
    Google Admob: 19.5.0.4
    Facebook: 6.2.0.1
    UnityAds: 3.5.1.0
    Vungle: 6.8.1.1
    InMobi: 9.1.1.2
     
  8. RGV

    RGV

    Joined:
    Jan 25, 2016
    Posts:
    48
    Has anyone solved this?
     
  9. xqwww

    xqwww

    Joined:
    Sep 26, 2017
    Posts:
    3
    Do you use Banner's ads type?
     
  10. umair_hassan1991

    umair_hassan1991

    Joined:
    Jun 27, 2018
    Posts:
    18
  11. Franciscotx56

    Franciscotx56

    Joined:
    Feb 8, 2019
    Posts:
    23
    any ideas?
     
  12. bachana707

    bachana707

    Joined:
    Jan 10, 2017
    Posts:
    1
    Hello, we have the same problem. have you found any solutions yet?
     

    Attached Files:

    Last edited: Feb 22, 2021
    yuliyF and Sandro8 like this.
  13. haroongamepace

    haroongamepace

    Joined:
    Feb 8, 2021
    Posts:
    2
    we're also facing same issue any solution
     
  14. AllanRW

    AllanRW

    Joined:
    Nov 6, 2014
    Posts:
    37
    Just a workaround for those with high ANR rate, just remove the most problematic devices from Google Play console device catalog, the worst device is the Huawei Y5 Lite but you can find some others on your ANR list, by doing this I've reduced the ANR rate from 0.60% to 0.31% in a few days.
     
    lucbloom likes this.
  15. jperry_oddgames

    jperry_oddgames

    Joined:
    Sep 18, 2017
    Posts:
    62
    We also saw a lot of "input dispatching timed out..." ANR reports recently, albeit with a different stacktrace related to MediaPlayer rather than WebView.
    Some googling led me to this post which claims our particular ANR should be fixed with an update to AppLovin.

    Again, this stacktrace doesn't quite match the one mentioned above in this thread, but I saw a few posters here mention AppLovin and figured i'd bring it up. Hopefully it helps
     
  16. absattarb

    absattarb

    Joined:
    Aug 5, 2021
    Posts:
    2
    1 solution I have, far now you have to make new build set minimum api level to 29, maximum api level 31. coz 90% of developers are facing this ANR in api level 27, 28.
    also try to code with try catch and nested ifs on android minimum memory size should be 2gb.
     
    lucbloom likes this.
  17. absattarb

    absattarb

    Joined:
    Aug 5, 2021
    Posts:
    2
    2nd solution is this link
    https://developer.android.com/topic/performance/vitals/anr
    3rd solution is
    try to track the device anrs occurred from anr reports and remove them from device catalog from your developer console. (Release management > Device catalog.)
     
    Last edited: Oct 5, 2021
  18. lucbloom

    lucbloom

    Joined:
    Mar 27, 2020
    Posts:
    42
    Do you perhaps have a list and code to check the device name on GitHub or PasteBin?
     
  19. lucbloom

    lucbloom

    Joined:
    Mar 27, 2020
    Posts:
    42
    I've made a sneaky solution that might help. I'll be testing it on our live build over the coming weeks, and will report its effectiveness here. In the meantime, I welcome any suggestions to the idea and the implementation:
    https://github.com/lucbloom/unity_anr_supervisor

    ANR Supervisor
    A system that detects ANRs in the main thread and closes the game before the ANR is reported to Google. It reports the ANR to our own backend, which stores it in a Database for review.

    This alleviates the ANR rate reported by Google Analytics. Most ANRs are caused by Ad SDKs (e.g. Google's own AdMob), so there is an option to only enable it during ad views.

    Another solution could be to make a list of problematic devices and not show ads on those devices, but that's a project for another time.​
     
    Last edited: May 17, 2022
  20. lucbloom

    lucbloom

    Joined:
    Mar 27, 2020
    Posts:
    42
  21. kidzooly

    kidzooly

    Joined:
    Jan 23, 2016
    Posts:
    26
    Thanks @luckbloom for keeping us posted on the developments. We will also try and post an update if we come across any improvements.

    Update : Seems Unity AdMob SDK is not yet updated to be in compatible with
    com.google.android.gms: play-services-ads:21.0.0..right now while integrate we are getting this error - https://github.com/googleads/googleads-mobile-unity/issues/2062
    Checking other options.
     
    Last edited: May 31, 2022
  22. lucbloom

    lucbloom

    Joined:
    Mar 27, 2020
    Posts:
    42
  23. kidzooly

    kidzooly

    Joined:
    Jan 23, 2016
    Posts:
    26
  24. Naveed_Khurshid

    Naveed_Khurshid

    Joined:
    Oct 8, 2016
    Posts:
    4
    Hi Lucbloom , have you reduced anr's by using this??
     
    yuliyF likes this.
  25. Tomurtogu

    Tomurtogu

    Joined:
    Nov 30, 2012
    Posts:
    26
    I was wondering that too
     
  26. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    75
    @lucbloom I am curious too, have you reduced the ANRs with the ANR supervisor?
     
  27. Ashar01

    Ashar01

    Joined:
    Aug 1, 2014
    Posts:
    6
    Avoid using Awake() too much use Start() instead. Doing this my ANR's dropped from 0.7% to 0.19%

    Use Awake() in just one script per scene.

    Me myself was facing the increasing ANR's issue and I got them reduced from 0.7% to 0.19% just by replacing Awake() by Start()
     
  28. peon_1

    peon_1

    Joined:
    Aug 16, 2014
    Posts:
    5
    Has this been confirmed? If that's correct, can some unity official shed some light on why this is the case?