ANR Error Log debugging method

Source: Internet
Author: User
  • What is ANR?
ANR -- application not responding indicates that the application has no response. This error is usually caused by the long execution time of an operation in the main Android thread. When the response to the user operation is not supported for more than 5 seconds, this exception occurs.

  • How to debug ANR? (Conventional log + traces)
1. Tracking ANR Errors Based on logs is the first thought of method. When an ANR error occurs, type the "ANR" keyword in ddms. The key information found is as follows:
Through "ANR in
Com. Android. MMS (COM. Android. MMS/. UI. composemessageactivity) "can be used to determine the class where ANR occurs, but it cannot be specific to the class.

2. Use traces to further determine the ANR position in the main thread code segment. From the above log, we can find that the virtual tracing information (traces) is in the/data/ANR/traces.txt file, so we can get the traces information from the Android system directory pull, here, we only need to pay attention to the main thread section in the Information. Here we can track the positions of all the ANR code segments. The key information is as follows:
----- PID 4643 at 09:30:15 -----
Cmd Line: COM. Android. MMS

Dalvik threads:
(Mutexes: tll = 0 TSL = 0 tscl = 0 ghl = 0)
"Main" PRIO = 5 tid = 1 native
| Group = "Main" scount = 1 dscount = 0 OBJ = 0x40a41460 self = 0x12830
| Shard id = 4643 nice = 0 sched = 0/0 CRL = default handle = 1074484360
| Schedstat = (3046338809 1442990863 4584) UTM = 231 STM = 73 core = 0
At Android. OS. binderproxy. transact (native method)
At Android. content. contentproviderproxy. Delete (contentprovidernative. Java: 477)
At Android. content. contentresolver. Delete (contentresolver. Java: 822)
At com. Google. Android. mms. util. sqlitewrapper. Delete (sqlitewrapper. Java: 102)
At com. Android. mms. util. PDU. pdupersister. updateparts (pdupersister. Java: 1136)
At com. Android. mms. UI. composemessageactivity. updatetemporarymmsmessage (composemessageactivity. Java: 5327)
At com. Android. mms. UI. composemessageactivity. oncreate (composemessageactivity. Java: 1114)
At Android. App. activity. javasmcreate (activity. Java: 4465)
At Android. App. instrumentation. callactivityoncreate (instrumentation. Java: 1049)
At Android. App. activitythread. javasmlaunchactivity (activitythread. Java: 1920)
At Android. App. activitythread. handlelaunchactivity (activitythread. Java: 1981)
At Android. App. activitythread. Access $600 (activitythread. Java: 123)
At Android. App. activitythread $ H. handlemessage (activitythread. Java: 1147)
At Android. OS. handler. dispatchmessage (handler. Java: 99)
At Android. OS. lorule. Loop (lorule. Java: 137)
At Android. App. activitythread. Main (activitythread. Java: 4424)
At java. Lang. Reflect. method. invokenative (native method)
At java. Lang. Reflect. method. Invoke (method. Java: 511)
At com. Android. Internal. OS. zygoteinit $ methodandargscaller. Run (zygoteinit. Java: 784)
At com. Android. Internal. OS. zygoteinit. Main (zygoteinit. Java: 551)
At Dalvik. system. nativestart. Main (native method)

"Binder thread #3" PRIO = 5 tid = 11 native
| Group = "Main" scount = 1 dscount = 0 OBJ = 0x413b8228 self = 0x249850
| Shard id = 4659 nice = 0 sched = 0/0 CRL = default handle = 2409128
| Schedstat = (14394770 31601688 74) UTM = 0 STM = 1 core = 1
At Dalvik. system. nativestart. Run (native method)

"Binder thread #2" PRIO = 5 tid = 10 native
| Group = "Main" scount = 1 dscount = 0 OBJ = 0x4132d578 self = 0x1d9c00
| Shard id = 4655 nice = 0 sched = 0/0 CRL = default handle = 2036400
| Schedstat = (14471462 45496768 80) UTM = 1 STM = 0 core = 0
At Dalvik. system. nativestart. Run (native method)

"Binder thread #1" PRIO = 5 tid = 9 native
| Group = "Main" scount = 1 dscount = 0 OBJ = 0x4132c310 self = 0x1301f8
| Shard id = 4654 nice = 0 sched = 0/0 CRL = default handle = 1820784
| Schedstat = (20176387 45620614 99) UTM = 0 STM = 2 core = 0
At Dalvik. system. nativestart. Run (native method)

"Finalizerwatchdogdaemon" daemon PRIO = 5 tid = 8 timed_wait
| Group = "Main" scount = 1 dscount = 0 OBJ = 0x41329058 self = 0x192d88
| Shard id = 4653 nice = 0 sched = 0/0 CRL = default handle = 1820448
| Schedstat = (4016231 26680923 29) UTM = 0 STM = 0 core = 1
At java. Lang. vmthread. Sleep (native method)
At java. Lang. thread. Sleep (thread. Java: 1031)
At java. Lang. thread. Sleep (thread. Java: 1013)
At java. Lang. Daemons $ finalizerwatchdogdaemon. Run (daemons. Java: 213)
At java. Lang. thread. Run (thread. Java: 856)

"Finalizerdaemon" daemon PRIO = 5 tid = 7 wait
| Group = "Main" scount = 1 dscount = 0 OBJ = 0x41328f00 self = 0x1e60e8
| Shard id = 4652 nice = 0 sched = 0/0 CRL = default handle = 1954272
| Schedstat = (49894771 22048696 51) UTM = 4 STM = 0 core = 1
At java. Lang. Object. Wait (native method)
-Waiting on <0x40a375d0> (a java. Lang. Ref. referencequeue)
At java. Lang. Object. Wait (object. Java: 401)
At java. Lang. Ref. referencequeue. Remove (referencequeue. Java: 102)
At java. Lang. Ref. referencequeue. Remove (referencequeue. Java: 73)
At java. Lang. Daemons $ finalizerdaemon. Run (daemons. Java: 168)
At java. Lang. thread. Run (thread. Java: 856)

"Referencequeuedaemon" daemon PRIO = 5 tid = 6 wait
| Group = "Main" scount = 1 dscount = 0 OBJ = 0x41328d98 self = 0x1f3bc8
| Shard id = 4651 nice = 0 sched = 0/0 CRL = default handle = 2004936
| Schedstat = (4019465 10248616 64) UTM = 0 STM = 0 core = 1
At java. Lang. Object. Wait (native method)
-Waiting on <0x40a374f8>
At java. Lang. Object. Wait (object. Java: 364)
At java. Lang. Daemons $ referencequeuedaemon. Run (daemons. Java: 128)
At java. Lang. thread. Run (thread. Java: 856)

"Compiler" daemon PRIO = 5 tid = 5 vmwait
| Group = "system" scount = 1 dscount = 0 OBJ = 0x41328ca8 self = 0x97c20
| Shard id = 4650 nice = 0 sched = 0/0 CRL = default handle = 1987992
| Schedstat = (381418863 78958694 2470) UTM = 27 STM = 11 core = 0
At Dalvik. system. nativestart. Run (native method)

"Jdwp" daemon PRIO = 5 tid = 4 vmwait
| Group = "system" scount = 1 dscount = 0 OBJ = 0x41328bc0 self = 0x9aac8
| Shard id = 4649 nice = 0 sched = 0/0 CRL = default handle = 1779192
| Schedstat = (3926772 18867998 15) UTM = 0 STM = 0 core = 1
At Dalvik. system. nativestart. Run (native method)

"Signal catcher" daemon PRIO = 5 tid = 3 runnable
| Group = "system" scount = 0 dscount = 0 OBJ = 0x41328ac8 self = 0x1f09e8
| Shard id = 4647 nice = 0 sched = 0/0 CRL = default handle = 1958480
| Schedstat = (463385 5608077 4) UTM = 0 STM = 0 core = 1
At Dalvik. system. nativestart. Run (native method)

"GC" daemon PRIO = 5 tid = 2 vmwait
| Group = "system" scount = 1 dscount = 0 OBJ = 0x413289e8 self = 0xa6310
| Shard id = 4645 nice = 0 sched = 0/0 CRL = default handle = 1957976
| Schedstat = (183059235 86740380 82) UTM = 16 STM = 2 core = 1
At Dalvik. system. nativestart. Run (native method)

----- End4643 -----

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.