Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ANR Input dispatching timed out (server) is not responding

In my Android application I am getting a very strange crash randomly. When I open the application I am fetching data from server on splash screen. When the application land on home page suddenly whole application is closed and here is what gets printed in the log:

ANR in com.test (com.test/.activities.SplashActivity)
    PID: 16020
    Reason: Input dispatching timed out (49abf6 com.test/com.test.activities.SplashActivity (server) is not responding. Waited 5004ms for FocusEvent(hasFocus=false))
Parent: com.test/.activities.SplashActivity
    Load: 29.87 / 30.79 / 30.77
    ----- Output from /proc/pressure/memory -----
    some avg10=0.00 avg60=0.00 avg300=0.00 total=3115344
    full avg10=0.00 avg60=0.00 avg300=0.00 total=1338179
    ----- End output from /proc/pressure/memory -----
like image 420
Amitanshu Gupta Avatar asked Jan 30 '26 07:01

Amitanshu Gupta


1 Answers

The cause of this exception is that UI thread is blocked and your application is not responding for more than 5 seconds.

Double check that the code fetching data from server is not executed on main thread. Also if you are using a braodcast receiver to do any logic that could take 10 seconds will lead to this issue.

Something else to check is the exception handling in the code fetching data from server.

You can take a look at the following page also: https://developer.android.com/training/articles/perf-anr.html#anr

like image 69
mabulazm Avatar answered Jan 31 '26 19:01

mabulazm