[Android] 分析一个CalledFromWrongThreadException崩溃

Posted kuliuheng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Android] 分析一个CalledFromWrongThreadException崩溃相关的知识,希望对你有一定的参考价值。

1 问题描述

  问题本身比较清晰简单,但推敲的过程中发现了不少有意思的东西。

  在C++ SDK回调JNI至Java Observer函数中,直接操作了UI界面textView.setText(msg),第一次回调没有崩溃,第二次回调(或者退出Activity)时才会崩溃。奇怪不?崩溃栈信息如下:

技术图片
07-02 16:04:07.503 32666   665 W ackor   : [KLH]OnNotifyClick - 1 jenv=0x920544c0
07-02 16:04:07.503 32666   665 W ackor   : [KLH]OnNotifyClick - 2 jenv=0x920544c0, swigjobj=0x200001
07-02 16:04:07.528 32666   665 I KLH     : ThreadID=1066, 您点击了 路线 2943762314
07-02 16:04:07.528 32666   665 I KLH     : 切换备选线路:0
07-02 16:04:25.546 32666   665 W ackor   : [KLH]OnNotifyClick - 1 jenv=0x920544c0
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI NewLocalRef called with pending exception android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.ViewRootImpl.checkThread() (ViewRootImpl.java:6648)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.ViewRootImpl.requestLayout() (ViewRootImpl.java:941)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.widget.RelativeLayout.requestLayout() (RelativeLayout.java:361)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.widget.TextView.checkForRelayout() (TextView.java:7175)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.widget.TextView.setText(java.lang.CharSequence, android.widget.TextView$BufferType, boolean, int) (TextView.java:4357)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.widget.TextView.setText(java.lang.CharSequence, android.widget.TextView$BufferType) (TextView.java:4214)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.widget.TextView.setText(java.lang.CharSequence) (TextView.java:4189)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void com.autonavi.auto.activity.guide.GuideActivity$1.onNotifyClick(com.autonavi.gbl.map.layer.BaseLayer, com.autonavi.gbl.map.layer.LayerItem) (GuideActivity.java:184)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void com.autonavi.gbl.map.router.LayerClickObserverRouter.onNotifyClick(com.autonavi.gbl.map.layer.impl.BaseLayerImpl, com.autonavi.gbl.map.layer.impl.LayerItemImpl) (LayerClickObserverRouter.java:102)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void com.autonavi.gbl.map.layer.observer.impl.MapLayerObserverJNI.SwigDirector_ILayerClickObserverImpl_onNotifyClick(com.autonavi.gbl.map.layer.observer.impl.ILayerClickObserverImpl, com.autonavi.gbl.map.layer.impl.BaseLayerImpl, com.autonavi.gbl.map.layer.impl.LayerItemImpl) (MapLayerObserverJNI.java:20)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410] 
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]     in call to NewLocalRef
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410] "Thread-1066" prio=10 tid=33 Runnable
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x13cae0a0 self=0x924bd100
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   | sysTid=665 nice=-10 cgrp=default sched=0/0 handle=0x978bf930
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 36753958 8117707 95 ) utm=3 stm=0 core=3 HZ=100
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   | stack=0x977c3000-0x977c5000 stackSize=1014KB
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #00 pc 003715ef  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+142)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #01 pc 0035050b  /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEP12BacktraceMap+166)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #02 pc 0025a81b  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+742)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #03 pc 0025aef5  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+64)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #04 pc 000fd491  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+32)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #05 pc 001025a5  /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE.constprop.95+5072)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #06 pc 00107b59  /system/lib/libart.so (_ZN3art8CheckJNI11NewLocalRefEP7_JNIEnvP8_jobject+392)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #07 pc 001dff93  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #08 pc 00718f85  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #09 pc 006fbd57  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #10 pc 0070d2d9  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #11 pc 007018bd  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #12 pc 006dced5  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #13 pc 0070ebcd  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #14 pc 0070ed61  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #15 pc 001998e5  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl17BaseMessageLooper13onProcMessageEPNS_7MessageE+96)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #16 pc 001996b1  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl6Looper4loopEv+32)
07-02 16:04:25.603 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #17 pc 0016ba47  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl13MessageThread3runEv+50)
07-02 16:04:25.603 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #18 pc 0016902d  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl6Thread11runCallbackEPv+32)
07-02 16:04:25.603 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #19 pc 0003f567  /system/lib/libc.so (_ZL15__pthread_startPv+30)
07-02 16:04:25.603 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   native: #20 pc 00019c37  /system/lib/libc.so (__start_thread+6)
07-02 16:04:25.603 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   (no managed stack frames)
07-02 16:04:25.603 32666   665 F art     : art/runtime/java_vm_ext.cc:410] 
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366] Runtime aborting...
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366] Aborting thread:
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366] "Thread-1066" prio=10 tid=33 Native
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x13cae0a0 self=0x924bd100
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   | sysTid=665 nice=-10 cgrp=default sched=0/0 handle=0x978bf930
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   | state=R schedstat=( 90513646 9084738 102 ) utm=7 stm=2 core=3 HZ=100
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   | stack=0x977c3000-0x977c5000 stackSize=1014KB
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   | held mutexes= "abort lock"
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   native: #00 pc 003715ef  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+142)
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   native: #01 pc 0035050b  /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEP12BacktraceMap+166)
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 003339f5  /system/lib/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+28)
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 00333c93  /system/lib/libart.so (_ZN3art7Runtime5AbortEv+566)
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   native: #04 pc 000f48bb  /system/lib/libart.so (_ZN3art10LogMessageD2Ev+2226)
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   native: #05 pc 0025ab45  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1552)
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   native: #06 pc 0025aef5  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+64)
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   native: #07 pc 000fd491  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+32)
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   native: #08 pc 001025a5  /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE.constprop.95+5072)
07-02 16:04:25.856 32666   665 F art     : art/runtime/runtime.cc:366]   native: #09 pc 00107b59  /system/lib/libart.so (_ZN3art8CheckJNI11NewLocalRefEP7_JNIEnvP8_jobject+392)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #10 pc 001dff93  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #11 pc 00718f85  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #12 pc 006fbd57  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #13 pc 0070d2d9  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #14 pc 007018bd  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #15 pc 006dced5  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #16 pc 0070ebcd  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #17 pc 0070ed61  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #18 pc 001998e5  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl17BaseMessageLooper13onProcMessageEPNS_7MessageE+96)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #19 pc 001996b1  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl6Looper4loopEv+32)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #20 pc 0016ba47  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl13MessageThread3runEv+50)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #21 pc 0016902d  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl6Thread11runCallbackEPv+32)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #22 pc 0003f567  /system/lib/libc.so (_ZL15__pthread_startPv+30)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #23 pc 00019c37  /system/lib/libc.so (__start_thread+6)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   (no managed stack frames)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366] Pending exception android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.view.ViewRootImpl.checkThread() (ViewRootImpl.java:6648)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.view.ViewRootImpl.requestLayout() (ViewRootImpl.java:941)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.widget.RelativeLayout.requestLayout() (RelativeLayout.java:361)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.widget.TextView.checkForRelayout() (TextView.java:7175)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.widget.TextView.setText(java.lang.CharSequence, android.widget.TextView$BufferType, boolean, int) (TextView.java:4357)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.widget.TextView.setText(java.lang.CharSequence, android.widget.TextView$BufferType) (TextView.java:4214)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void android.widget.TextView.setText(java.lang.CharSequence) (TextView.java:4189)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void com.autonavi.auto.activity.guide.GuideActivity$1.onNotifyClick(com.autonavi.gbl.map.layer.BaseLayer, com.autonavi.gbl.map.layer.LayerItem) (GuideActivity.java:184)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void com.autonavi.gbl.map.router.LayerClickObserverRouter.onNotifyClick(com.autonavi.gbl.map.layer.impl.BaseLayerImpl, com.autonavi.gbl.map.layer.impl.LayerItemImpl) (LayerClickObserverRouter.java:102)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   at void com.autonavi.gbl.map.layer.observer.impl.MapLayerObserverJNI.SwigDirector_ILayerClickObserverImpl_onNotifyClick(com.autonavi.gbl.map.layer.observer.impl.ILayerClickObserverImpl, com.autonavi.gbl.map.layer.impl.BaseLayerImpl, com.autonavi.gbl.map.layer.impl.LayerItemImpl) (MapLayerObserverJNI.java:20)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366] Dumping all threads without appropriate locks held: thread list lock mutator lock
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366] All threads:
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366] DALVIK THREADS (33):
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366] "Thread-1066" prio=10 tid=33 Runnable
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x13cae0a0 self=0x924bd100
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   | sysTid=665 nice=-10 cgrp=default sched=0/0 handle=0x978bf930
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   | state=R schedstat=( 150270939 24532079 121 ) utm=10 stm=5 core=2 HZ=100
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   | stack=0x977c3000-0x977c5000 stackSize=1014KB
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   | held mutexes= "abort lock" "mutator lock"(shared held)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #00 pc 003715ef  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+142)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #01 pc 0035050b  /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEP12BacktraceMap+166)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 0035ae17  /system/lib/libart.so (_ZN3art14DumpCheckpoint3RunEPNS_6ThreadE+478)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 0035b9e9  /system/lib/libart.so (_ZN3art10ThreadList13RunCheckpointEPNS_7ClosureEb+216)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #04 pc 0035c0d3  /system/lib/libart.so (_ZN3art10ThreadList4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+142)
07-02 16:04:25.857 32666   665 F art     : art/runtime/runtime.cc:366]   native: #05 pc 00333c09  /system/lib/libart.so (_ZN3art7Runtime5AbortEv+428)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #06 pc 000f48bb  /system/lib/libart.so (_ZN3art10LogMessageD2Ev+2226)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #07 pc 0025ab45  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1552)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #08 pc 0025aef5  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+64)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #09 pc 000fd491  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+32)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #10 pc 001025a5  /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE.constprop.95+5072)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #11 pc 00107b59  /system/lib/libart.so (_ZN3art8CheckJNI11NewLocalRefEP7_JNIEnvP8_jobject+392)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #12 pc 001dff93  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #13 pc 00718f85  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #14 pc 006fbd57  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #15 pc 0070d2d9  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #16 pc 007018bd  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #17 pc 006dced5  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #18 pc 0070ebcd  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #19 pc 0070ed61  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so (???)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #20 pc 001998e5  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl17BaseMessageLooper13onProcMessageEPNS_7MessageE+96)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #21 pc 001996b1  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl6Looper4loopEv+32)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #22 pc 0016ba47  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl13MessageThread3runEv+50)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #23 pc 0016902d  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl6Thread11runCallbackEPv+32)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #24 pc 0003f567  /system/lib/libc.so (_ZL15__pthread_startPv+30)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #25 pc 00019c37  /system/lib/libc.so (__start_thread+6)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   (no managed stack frames)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366] 
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366] "main" prio=10 tid=1 Native
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x743223b0 self=0xb4d36500
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   | sysTid=32666 nice=-10 cgrp=default sched=0/0 handle=0xb6fb9b34
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 5741020825 1129647912 12980 ) utm=486 stm=88 core=0 HZ=100
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   | stack=0xbe5f1000-0xbe5f3000 stackSize=8MB
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   | held mutexes=
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #00 pc 0004099c  /system/lib/libc.so (__epoll_pwait+20)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #01 pc 00019f63  /system/lib/libc.so (epoll_pwait+26)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 00019f71  /system/lib/libc.so (epoll_wait+6)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 00012ce7  /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+102)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #04 pc 00012f63  /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+130)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #05 pc 00086d11  /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #06 pc 0000055d  /data/dalvik-cache/arm/[email protected]@boot.oat (Java_android_os_MessageQueue_nativePollOnce__JI+96)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   at android.os.MessageQueue.nativePollOnce(Native method)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   at android.os.MessageQueue.next(MessageQueue.java:323)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   at android.os.Looper.loop(Looper.java:141)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   at android.app.ActivityThread.main(ActivityThread.java:5684)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.reflect.Method.invoke!(Native method)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:746)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366] 
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366] "Signal Catcher" prio=10 tid=2 WaitingInMainSignalCatcherLoop
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d530a0 self=0xaec66500
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   | sysTid=32671 nice=0 cgrp=default sched=0/0 handle=0xb42ac930
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 2433179 2107707 47 ) utm=0 stm=0 core=2 HZ=100
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   | stack=0xb41b0000-0xb41b2000 stackSize=1014KB
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   | held mutexes=
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #00 pc 00040c70  /system/lib/libc.so (__rt_sigtimedwait+12)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #01 pc 0001ca57  /system/lib/libc.so (sigwait+22)
07-02 16:04:25.858 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 0033a80d  /system/lib/libart.so (_ZN3art13SignalCatcher13WaitForSignalEPNS_6ThreadERNS_9SignalSetE+76)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 0033b96f  /system/lib/libart.so (_ZN3art13SignalCatcher3RunEPv+218)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #04 pc 0003f567  /system/lib/libc.so (_ZL15__pthread_startPv+30)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #05 pc 00019c37  /system/lib/libc.so (__start_thread+6)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   (no managed stack frames)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366] 
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366] "JDWP" prio=10 tid=3 WaitingInMainDebuggerLoop
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d560a0 self=0xab3d1500
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | sysTid=32672 nice=0 cgrp=default sched=0/0 handle=0xb41a8930
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 2514634 1078439 10 ) utm=0 stm=0 core=0 HZ=100
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | stack=0xb40ac000-0xb40ae000 stackSize=1014KB
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | held mutexes=
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #00 pc 00040b8c  /system/lib/libc.so (__pselect6+20)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #01 pc 0001bda9  /system/lib/libc.so (select+60)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 00401a93  /system/lib/libart.so (_ZN3art4JDWP12JdwpAdbState15ProcessIncomingEv+218)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 00266f3f  /system/lib/libart.so (_ZN3art4JDWP9JdwpState3RunEv+314)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #04 pc 00267dbd  /system/lib/libart.so (_ZN3art4JDWPL15StartJdwpThreadEPv+16)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #05 pc 0003f567  /system/lib/libc.so (_ZL15__pthread_startPv+30)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #06 pc 00019c37  /system/lib/libc.so (__start_thread+6)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   (no managed stack frames)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366] 
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366] "ReferenceQueueDaemon" prio=10 tid=4 Waiting
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d4fd00 self=0xab3d1f00
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | sysTid=32673 nice=0 cgrp=default sched=0/0 handle=0xb40a2930
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 8008126 3268022 31 ) utm=0 stm=0 core=0 HZ=100
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | stack=0xb3fa0000-0xb3fa2000 stackSize=1038KB
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | held mutexes=
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #00 pc 00017640  /system/lib/libc.so (syscall+28)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #01 pc 000f6e09  /system/lib/libart.so (_ZN3art17ConditionVariable4WaitEPNS_6ThreadE+96)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 002bed09  /system/lib/libart.so (_ZN3art7Monitor4WaitEPNS_6ThreadExibNS_11ThreadStateE+1144)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 002bfa67  /system/lib/libart.so (_ZN3art7Monitor4WaitEPNS_6ThreadEPNS_6mirror6ObjectExibNS_11ThreadStateE+142)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #04 pc 002d1333  /system/lib/libart.so (_ZN3artL11Object_waitEP7_JNIEnvP8_jobject+38)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #05 pc 0000036f  /data/dalvik-cache/arm/[email protected]@boot.oat (Java_java_lang_Object_wait__+74)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Object.wait!(Native method)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   - waiting on <0x0d838ddd> (a java.lang.Class<java.lang.ref.ReferenceQueue>)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:152)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   - locked <0x0d838ddd> (a java.lang.Class<java.lang.ref.ReferenceQueue>)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:818)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366] 
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366] "FinalizerDaemon" prio=10 tid=5 Waiting
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d4fd60 self=0xab3d2900
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | sysTid=32674 nice=0 cgrp=default sched=0/0 handle=0xb3f98930
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 32700265 11453953 62 ) utm=2 stm=1 core=3 HZ=100
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | stack=0xb3e96000-0xb3e98000 stackSize=1038KB
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   | held mutexes=
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #00 pc 00017640  /system/lib/libc.so (syscall+28)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #01 pc 000f6e09  /system/lib/libart.so (_ZN3art17ConditionVariable4WaitEPNS_6ThreadE+96)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 002bed09  /system/lib/libart.so (_ZN3art7Monitor4WaitEPNS_6ThreadExibNS_11ThreadStateE+1144)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 002bfa67  /system/lib/libart.so (_ZN3art7Monitor4WaitEPNS_6ThreadEPNS_6mirror6ObjectExibNS_11ThreadStateE+142)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #04 pc 002d136d  /system/lib/libart.so (_ZN3artL13Object_waitJIEP7_JNIEnvP8_jobjectxi+44)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   native: #05 pc 0000055d  /data/dalvik-cache/arm/[email protected]@boot.oat (Java_java_lang_Object_wait__JI+96)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Object.wait!(Native method)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   - waiting on <0x0c2aed52> (a java.lang.ref.ReferenceQueue)
07-02 16:04:25.859 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Object.wait(Object.java:423)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:101)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   - locked <0x0c2aed52> (a java.lang.ref.ReferenceQueue)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:72)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:217)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:818)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366] 
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366] "FinalizerWatchdogDaemon" prio=10 tid=6 Sleeping
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d4fdc0 self=0xab3d2e00
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | sysTid=32675 nice=0 cgrp=default sched=0/0 handle=0xb3e8e930
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 638801 453698 5 ) utm=0 stm=0 core=3 HZ=100
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | stack=0xb3d8c000-0xb3d8e000 stackSize=1038KB
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | held mutexes=
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #00 pc 00017644  /system/lib/libc.so (syscall+32)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #01 pc 000f7089  /system/lib/libart.so (_ZN3art17ConditionVariable9TimedWaitEPNS_6ThreadExi+120)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 002bea5f  /system/lib/libart.so (_ZN3art7Monitor4WaitEPNS_6ThreadExibNS_11ThreadStateE+462)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 002bfa67  /system/lib/libart.so (_ZN3art7Monitor4WaitEPNS_6ThreadEPNS_6mirror6ObjectExibNS_11ThreadStateE+142)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #04 pc 0001b8db  /data/dalvik-cache/arm/[email protected]@boot.oat (Java_java_lang_Thread_sleep__Ljava_lang_Object_2JI+126)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Thread.sleep!(Native method)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   - sleeping on <0x02023823> (a java.lang.Object)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Thread.sleep(Thread.java:1031)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   - locked <0x02023823> (a java.lang.Object)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Thread.sleep(Thread.java:985)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerWatchdogDaemon.sleepFor(Daemons.java:324)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerWatchdogDaemon.waitForFinalization(Daemons.java:346)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:263)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:818)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366] 
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366] "HeapTaskDaemon" prio=10 tid=7 Blocked
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d4fe20 self=0xab3d3d00
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | sysTid=32676 nice=0 cgrp=default sched=0/0 handle=0xb3d84930
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 280288905 95066412 867 ) utm=23 stm=5 core=0 HZ=100
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | stack=0xb3c82000-0xb3c84000 stackSize=1038KB
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | held mutexes=
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #00 pc 00017640  /system/lib/libc.so (syscall+28)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #01 pc 000f6e09  /system/lib/libart.so (_ZN3art17ConditionVariable4WaitEPNS_6ThreadE+96)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 001d75dd  /system/lib/libart.so (_ZN3art2gc13TaskProcessor7GetTaskEPNS_6ThreadE+104)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 001d7b11  /system/lib/libart.so (_ZN3art2gc13TaskProcessor11RunAllTasksEPNS_6ThreadE+72)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #04 pc 0000036f  /data/dalvik-cache/arm/[email protected]@boot.oat (Java_dalvik_system_VMRuntime_runHeapTasks__+74)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at dalvik.system.VMRuntime.runHeapTasks(Native method)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   - waiting to lock an unknown object
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Daemons$HeapTaskDaemon.run(Daemons.java:443)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:818)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366] 
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366] "Binder:32666_1" prio=10 tid=8 Native
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d650a0 self=0xaec67900
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | sysTid=32677 nice=0 cgrp=default sched=0/0 handle=0xb3b7e930
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 26304580 64742289 222 ) utm=1 stm=1 core=0 HZ=100
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | stack=0xb3a82000-0xb3a84000 stackSize=1014KB
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   | held mutexes=
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #00 pc 00040ac4  /system/lib/libc.so (__ioctl+8)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #01 pc 00047541  /system/lib/libc.so (ioctl+14)
07-02 16:04:25.860 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 0001e9e9  /system/lib/libbinder.so (_ZN7android14IPCThreadState14talkWithDriverEb+132)
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 0001eed7  /system/lib/libbinder.so (_ZN7android14IPCThreadState20getAndExecuteCommandEv+6)
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   native: #04 pc 0001eff1  /system/lib/libbinder.so (_ZN7android14IPCThreadState14joinThreadPoolEb+48)
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   native: #05 pc 0002393d  /system/lib/libbinder.so (???)
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   native: #06 pc 00010075  /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv+112)
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   native: #07 pc 00063bff  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime15javaThreadShellEPv+70)
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   native: #08 pc 0003f567  /system/lib/libc.so (_ZL15__pthread_startPv+30)
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   native: #09 pc 00019c37  /system/lib/libc.so (__start_thread+6)
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   (no managed stack frames)
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366] 
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366] "Binder:32666_2" prio=10 tid=9 Native
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d690a0 self=0xab3d5100
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   | sysTid=32678 nice=0 cgrp=default sched=0/0 handle=0xb3a7a930
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 22970576 60971763 168 ) utm=0 stm=2 core=0 HZ=100
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   | stack=0xb397e000-0xb3980000 stackSize=1014KB
07-02 16:04:25.861 32666   665 F art     : art/runtime/runtime.cc:366]   | held mutexes=
07-02 16:04:25.863 32666   665 F art     : art/runtime/runtime.cc:366]   native: #06 pc 0016ba47  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl13MessageThread3runEv+50)
07-02 16:04:25.864 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 10788865124 3340925381 63245 ) utm=923 stm=155 core=0 HZ=100
07-02 16:04:25.864 32666   665 F art     : art/runtime/runtime.cc:366]   native: #15 pc 0016902d  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl6Thread11runCallbackEPv+32)
07-02 16:04:25.864 32666   665 F art     : art/runtime/runtime.cc:366]   native: #00 pc 00017640  /system/lib/libc.so (syscall+28)
07-02 16:04:25.864 32666   665 F art     : art/runtime/runtime.cc:366]   native: #01 pc 0003f383  /system/lib/libc.so (_ZL33__pthread_cond_timedwait_relativeP23pthread_cond_internal_tP15pthread_mutex_tPK8timespec+56)
07-02 16:04:25.865 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 001a9049  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl9LockLinux4waitEv+12)
07-02 16:04:25.865 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 001a9049  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl9LockLinux4waitEv+12)
07-02 16:04:25.865 32666   665 F art     : art/runtime/runtime.cc:366]   native: #08 pc 00019c37  /system/lib/libc.so (__start_thread+6)
07-02 16:04:25.865 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 482854059 246558867 537 ) utm=46 stm=2 core=2 HZ=100
07-02 16:04:25.865 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 006a6b63  /data/app/com.autonavi.auto-2/lib/arm/libGNaviDice.so (???)
07-02 16:04:25.865 32666   665 F art     : art/runtime/runtime.cc:366]   (no managed stack frames)
07-02 16:04:25.865 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 193895952 94785157 558 ) utm=17 stm=2 core=3 HZ=100
07-02 16:04:25.866 32666   665 F art     : art/runtime/runtime.cc:366]   (no managed stack frames)
07-02 16:04:25.866 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 98861144 66345989 196 ) utm=9 stm=0 core=1 HZ=100
07-02 16:04:25.866 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 79828231 32187811 197 ) utm=6 stm=1 core=3 HZ=100
07-02 16:04:25.866 32666   665 F art     : art/runtime/runtime.cc:366]   native: #03 pc 006a6b63  /data/app/com.autonavi.auto-2/lib/arm/libGNaviDice.so (???)
07-02 16:04:25.866 32666   665 F art     : art/runtime/runtime.cc:366]   | state=S schedstat=( 16315991 56947804 135 ) utm=0 stm=1 core=0 HZ=100
07-02 16:04:25.867 32666   665 F art     : art/runtime/runtime.cc:366]   native: #08 pc 0003f567  /system/lib/libc.so (_ZL15__pthread_startPv+30)
07-02 16:04:25.867 32666   665 F art     : art/runtime/runtime.cc:366]   native: #02 pc 001a9049  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (_ZN3asl9LockLinux4waitEv+12)
07-02 16:04:25.867 32666   665 F art     : art/runtime/runtime.cc:366]   native: #08 pc 00019c37  /system/lib/libc.so (__start_thread+6)
07-02 16:04:25.888 32666   665 E amap_so : useMyCorkscrew
07-02 16:04:25.889 32666   665 E dumpcrash_log: pid: 32666, tid: 665, useNewSignalAbortCatcher: 1, isHeapError: 0
07-02 16:04:26.140 32666   665 I amap_so : new catcher
07-02 16:04:26.215 32666   665 I amap_so : backtrace: #00 pc 00042058  /system/lib/libc.so (tgkill+12)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #01 pc 0003fc65  /system/lib/libc.so (pthread_kill+32)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #02 pc 0001c403  /system/lib/libc.so (raise+10)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #03 pc 000195b5  /system/lib/libc.so (__libc_android_abort+34)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #04 pc 00017508  /system/lib/libc.so (abort+4)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #05 pc 00325b41  /system/lib/libart.so (art::Runtime::Abort()+228)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #06 pc 000e68bb  /system/lib/libart.so (art::LogMessage::~LogMessage()+2226)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #07 pc 0024cb45  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1552)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #08 pc 0024cef5  /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+64)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #09 pc 000ef491  /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+32)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #10 pc 000f45a5  /system/lib/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) [clone .constprop.95]+5072)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #11 pc 000f9b59  /system/lib/libart.so (art::CheckJNI::NewLocalRef(_JNIEnv*, _jobject*)+392)
07-02 16:04:26.216 32666   665 I amap_so : backtrace: #12 pc 001dff93  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #13 pc 00718f85  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #14 pc 006fbd57  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #15 pc 0070d2d9  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #16 pc 007018bd  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #17 pc 006dced5  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #18 pc 0070ebcd  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #19 pc 0070ed61  /data/app/com.autonavi.auto-2/lib/arm/libGbl.so
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #20 pc 001998e5  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (asl::BaseMessageLooper::onProcMessage(asl::Message*)+96)
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #21 pc 001996b1  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (asl::Looper::loop()+32)
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #22 pc 0016ba47  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (asl::MessageThread::run()+50)
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #23 pc 0016902d  /data/app/com.autonavi.auto-2/lib/arm/libbase_utils.so (asl::Thread::runCallback(void*)+32)
07-02 16:04:26.217 32666   665 I amap_so : backtrace: #24 pc 0003f567  /system/lib/libc.so (__pthread_start(void*)+30)
07-02 16:04:26.218 32666   665 I amap_so : backtrace: #25 pc 00019c37  /system/lib/libc.so (__start_thread+6)
07-02 16:04:26.285 32666   665 E dumpcrash_log: start dumpExecute
07-02 16:04:26.286 32666   665 E dumpcrash_log: end dumpExecute
07-02 16:04:26.286 32666   665 W System.err: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
07-02 16:04:26.286 32666   665 W System.err:     at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6648)
07-02 16:04:26.286 32666   665 W System.err:     at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:941)
07-02 16:04:26.286 32666   665 W System.err:     at android.view.View.requestLayout(View.java:18764)
07-02 16:04:26.287 32666   665 W System.err:     at android.view.View.requestLayout(View.java:18764)
07-02 16:04:26.287 32666   665 W System.err:     at android.view.View.requestLayout(View.java:18764)
07-02 16:04:26.287 32666   665 W System.err:     at android.view.View.requestLayout(View.java:18764)
07-02 16:04:26.287 32666   665 W System.err:     at android.view.View.requestLayout(View.java:18764)
07-02 16:04:26.287 32666   665 W System.err:     at android.view.View.requestLayout(View.java:18764)
07-02 16:04:26.287 32666   665 W System.err:     at android.view.View.requestLayout(View.java:18764)
07-02 16:04:26.287 32666   665 W System.err:     at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:361)
07-02 16:04:26.287 32666   665 W System.err:     at android.view.View.requestLayout(View.java:18764)
07-02 16:04:26.287 32666   665 W System.err:     at android.view.View.requestLayout(View.java:18764)
07-02 16:04:26.287 32666   665 W System.err:     at android.widget.TextView.checkForRelayout(TextView.java:7175)
07-02 16:04:26.287 32666   665 W System.err:     at android.widget.TextView.setText(TextView.java:4357)
07-02 16:04:26.287 32666   665 W System.err:     at android.widget.TextView.setText(TextView.java:4214)
07-02 16:04:26.287 32666   665 W System.err:     at android.widget.TextView.setText(TextView.java:4189)
07-02 16:04:26.287 32666   665 W System.err:     at com.autonavi.auto.activity.guide.GuideActivity$1.onNotifyClick(GuideActivity.java:184)
07-02 16:04:26.287 32666   665 W System.err:     at com.autonavi.gbl.map.router.LayerClickObserverRouter.onNotifyClick(LayerClickObserverRouter.java:102)
07-02 16:04:26.287 32666   665 W System.err:     at com.autonavi.gbl.map.layer.observer.impl.MapLayerObserverJNI.SwigDirector_ILayerClickObserverImpl_onNotifyClick(MapLayerObserverJNI.java:20)
07-02 16:04:31.738 32666   665 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 665 (Thread-1066)
View Code

2 原因分析

  从崩溃栈中可以清晰看到原因,轻松得到如下结论:

2.1 非UI线程操作UI是Android不允许的

  有人总结了Android平台下UI线程理解经验:

Single Thread Model
1. 一个组件的创建并不会新建一个线程,他们的创建都在UI线程中进行,包括他们的回调方法,如onKeyDown()。
2. 当在UI线程中进行某些耗时的操作时,将会阻塞UI线程,一般阻塞超过5秒就会显示一个ANR对话框。
3. UI线程是非线程安全的,所以,不能在工作线程中操作UI元素。
 
两个原则
1. Do not block the UI thread (不要阻塞UI线程)
2. Do not access the Android UI toolkit from outside the UI thread (不要在工作线程中操作UI元素在工作线程更新UI方法
1. Activity.runOnUiThread(Runnable)
2. Handler
    sendMessage(Message)
    post(Runnable)
3. AsyncTask
    execute()
    doInBackground()
    onPostExecute()

2.2 引发了JNI层崩溃

  关于这一点,特别增加了日志可以确认,崩溃是因为NewLocalRef的时候发现有pending exception

3 推理过程

  (1)为何第一次Java exception没有直接崩溃退出?

  (2)如果说setText导致崩溃,那么为何设置“路径 1234567890”会崩溃,而设置“终点”二字却总也没崩溃?

  这里先来分析第一点,直接给出下面答案:

3.1 JNI层处理Exception并不会立即崩溃

  请参考这篇文章:《JNI官方规范中文版——如何在JNI中抛出Java异常

技术图片

  在我们的JNI层中,并没有调用

3.2 Android层Exception触发机制

  先参考下这两篇背景知识:《Android View重绘与更新》《Android不能在子线程更新UI的讨论和分析

  从崩溃栈信息其实也能看出来,崩溃栈的关键信息有:

07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI NewLocalRef called with pending exception android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.ViewRootImpl.checkThread() (ViewRootImpl.java:6648)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.ViewRootImpl.requestLayout() (ViewRootImpl.java:941)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.widget.RelativeLayout.requestLayout() (RelativeLayout.java:361)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.view.View.requestLayout() (View.java:18764)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.widget.TextView.checkForRelayout() (TextView.java:7175)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.widget.TextView.setText(java.lang.CharSequence, android.widget.TextView$BufferType, boolean, int) (TextView.java:4357)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.widget.TextView.setText(java.lang.CharSequence, android.widget.TextView$BufferType) (TextView.java:4214)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void android.widget.TextView.setText(java.lang.CharSequence) (TextView.java:4189)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void com.autonavi.auto.activity.guide.GuideActivity$1.onNotifyClick(com.autonavi.gbl.map.layer.BaseLayer, com.autonavi.gbl.map.layer.LayerItem) (GuideActivity.java:184)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void com.autonavi.gbl.map.router.LayerClickObserverRouter.onNotifyClick(com.autonavi.gbl.map.layer.impl.BaseLayerImpl, com.autonavi.gbl.map.layer.impl.LayerItemImpl) (LayerClickObserverRouter.java:102)
07-02 16:04:25.602 32666   665 F art     : art/runtime/java_vm_ext.cc:410]   at void com.autonavi.gbl.map.layer.observer.impl.MapLayerObserverJNI.SwigDirector_ILayerClickObserverImpl_onNotifyClick(com.autonavi.gbl.map.layer.observer.impl.ILayerClickObserverImpl, com.autonavi.gbl.map.layer.impl.BaseLayerImpl, com.autonavi.gbl.map.layer.impl.LayerItemImpl) (MapLayerObserverJNI.java:20)

   这里面有一个requestLayout,可以查到该函数用于Android控件的布局刷新,里面调用到ViewRootImpl.checkThread就会检查线程ID并抛异常。

  那如果没有触发requestLayout调用是不是就不会做这个ThreadID检查和抛异常了呢?是的!

技术图片

3.3 解答疑问

  (1)首次回调时,因JNI层缺少ExceptionCheck() 和相应的处理逻辑,导致Java exception并不会立即崩溃而是逻辑继续。。。当(二次回调)发生NewLocalRef等操作发生时才检测到有pending exception引发崩溃

  (2)非UI线程操作UI基本上都会崩溃,通过try...catch可以轻松获取信息。前提是需要触发checkThread调用。

  (3)Android在setText操作需要重新刷新Layout时才会有CheckThread,进而引发崩溃。Text太短了不会触发requestLayout,哈哈

  

 

以上是关于[Android] 分析一个CalledFromWrongThreadException崩溃的主要内容,如果未能解决你的问题,请参考以下文章

android性能优化之GPU呈现模式分析

Android属性动画AnimatorSet源码简单分析

Android5.1源码分析系列Settings源码分析

Android 性能分析工具之 TraceView 使用说明

Android消息循环分析

流输入的android频谱分析