Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: ANR Input dispatching timed out

I am getting following error logs on some phone which as follow:

Reason: 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: 20. Wait queue head age: 5509.1ms.)

I am using Retrofit 2 for networking calls in which I use async method, Using database as realm where I used async transaction for writing stuff. Using Glide for image loading.

On using Strict Mode I found out I get penalty log for shared preferences nothing else. Any other pointers to see and debug issue

like image 636
Sutirth Avatar asked Dec 01 '16 10:12

Sutirth


1 Answers

Any types of time expensive procedure like data syncing through network shouldn't do in main thread. Android has some default built-in methods like AsyncTask, IntentService etc. those are on worker thread. Personally I have not good idea about Retrofit 2. If it works on main thread, that case you should use it in a separate thread.

like image 173
Ratna Halder Avatar answered Sep 21 '22 12:09

Ratna Halder