在为Android编译的本机cpp应用程序中,我遇到了原因keyDispatchingTimedOut的ANR错误。只有当应用程序从本机活动切换到java活动时才会发生。
错误报告中没有任何内容真正脱颖而出。大多数线程只是坐在循环中等待输入。我无法透露任何代码,但58b505的代码来自android_native_app_glue库。
我附上了ANR错误报告:full ANR on pastebin
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 obj=0x741e33c0 self=0xab684ea8
| sysTid=29202 nice=-1 cgrp=default sched=0/0 handle=0xf778fb34
| state=S schedstat=( 962236509 24407600 624 ) utm=84 stm=12 core=4 HZ=100
| stack=0xff56e000-0xff570000 stackSize=8MB
| held mutexes=
native: pc 0000000000042c9c /system/lib/libc.so (__epoll_pwait+20)
native: pc 00000000000195cf /system/lib/libc.so (epoll_pwait+26)
native: pc 00000000000195dd /system/lib/libc.so (epoll_wait+6)
native: pc 0000000000012d8b /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+102)
native: pc 0000000000013007 /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+130)
native: pc 00000000000836fd /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
native: pc 000000000000055d /data/dalvik-cache/arm/system@framework@boot.oat (Java_android_os_MessageQueue_nativePollOnce__JI+96)
at android.os.MessageQueue.nativePollOnce (Native method)
at android.os.MessageQueue.next (MessageQueue.java:323)
at android.os.Looper.loop (Looper.java:135)
at android.app.ActivityThread.main (ActivityThread.java:5438)
at java.lang.reflect.Method.invoke! (Native method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:628)
"Thread-295" prio=6 tid=17 Native
| group="main" sCount=1 dsCount=0 obj=0x12c630a0 self=0xabdbcd60
| sysTid=29269 nice=-1 cgrp=default sched=0/0 handle=0xdabfd930
| state=S schedstat=( 15667236 2344530 115 ) utm=0 stm=1 core=6 HZ=100
| stack=0xdab01000-0xdab03000 stackSize=1014KB
| held mutexes=
native: pc 0000000000016908 /system/lib/libc.so (syscall+28)
native: pc 000000000004167b /system/lib/libc.so (_ZL33__pthread_cond_timedwait_relativeP23pthread_cond_internal_tP15pthread_mutex_tPK8timespec+56)
native: pc 000000000058b505 /data/app/com.package-1/lib/arm/libgame.so (???)
native: pc 000000000058b2ed /data/app/com.package-1/lib/arm/libgame.so (???)
native: pc 00000000005ac4c7 /data/app/com.package-1/lib/arm/libgame.so (???)
native: pc 000000000004185b /system/lib/libc.so (_ZL15__pthread_startPv+30)
native: pc 00000000000192a5 /system/lib/libc.so (__start_thread+6)