Sunday, July 3, 2011

How do I investigate an Application Not Responding (ANR) in Android?

Today I got an ANR error and it's really annoying because you know you have done something wrong and not sure where to look for to find out the problem.

When I googled, I found this on StackOverFlow.

"An ANR happens when some long operation takes place in the "main" thread. This is the event loop thread, and if it is busy, Android cannot process any further GUI events in the application, and thus throws up an ANR dialog." - From Stackoverflow

so, how to diagnose the problem, it's easy,

adb shell cat /data/anr/traces.txt

will drump all the appplication not responding traces to the command prompt. (Make sure to change the command prompt buffer size otherwise you can not see the full log out)

No comments:

Post a Comment