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 -----
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With