在我的Android logcat的日誌,我看到:爲什麼機器人在對待ANR程序的時候是在彎針等
01-02 02:01:46.523 E/ActivityManager( 459): ANR in com.android.phone (com.android.phone/.InCallScreen)
,然後當我去/data/anr/traces.txt,我見
Cmd line: com.android.phone
DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)
"main" prio=5 tid=1 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x410f7508 self=0x40eeeb68
| sysTid=649 nice=0 sched=0/0 cgrp=apps handle=1075429168
| schedstat=(0 0 0) utm=1361 stm=314 core=1
#00 pc 0000dac0 /system/lib/libc.so (epoll_wait+12)
#01 pc 00014899 /system/lib/libutils.so (android::Looper::pollInner(int)+96)
#02 pc 00014b01 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+104)
#03 pc 00063aeb /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
#04 pc 0001df30 /system/lib/libdvm.so (dvmPlatformInvoke+112)
#05 pc 0004d1fb /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
#06 pc 00038f4d /system/lib/libdvm.so (dvmCheckCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+8)
#07 pc 00000214 /dev/ashmem/dalvik-jit-code-cache (deleted)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:125)
at android.os.Looper.loop(Looper.java:124)
at android.app.ActivityThread.main(ActivityThread.java:4921)
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:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
我的問題是爲什麼android認爲應用程序在ANR中時,堆棧跟蹤顯示Looper等待消息中的主線程?這對我來說似乎很正常。當主線程正在下載某個東西/執行長操作時,我明白android顯示ANR。但它似乎很正常,它正在等待一條消息。如果我錯了,請覈對我。