Android应用程序在调试模式下启动时崩溃 [英] Android app crashes when launched in debug mode

查看:7587
本文介绍了Android应用程序在调试模式下启动时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在调试模式下运行时,应用程序崩溃,但是当我正常运行它时,它可以正常工作。
我认为调试器附加时会出现问题。



日志:

检查失败:Thread :: Current()!= GetDebugThread()(Thread :: Current()= 0x7f44a18400,GetDebugThread()=($)$ {code> A / art:art / runtime / jdwp / jdwp_event.cc: 0x7f44a18400)预期的事件线程
A / art:art / runtime / runtime.cc:422]运行时中止...
A / art:art / runtime / runtime.cc:422]中止线程:
A / art:art / runtime / runtime.cc:422]JDWPprio = 5 tid = 4 WaitingForDebuggerSend
A / art:art / runtime / runtime.cc:422] group =sCount = 0 dsCount = 0 obj = 0x12c60280 self = 0x7f44a18400
A / art:art / runtime / runtime.cc:422] | sysTid = 24137 nice = 0 cgrp = default sched = 0/0 handle = 0x7f4b904450
A / art:art / runtime / runtime.cc:422] state = R schedstat =(132066712 16401043 106)utm = 9 stm = 2 core = 3 HZ = 100
A / art:art / runtime / runtime.cc:422] stack = 0x7f4b80a000-0x7f4b80c000 stackSize = 1005KB
A / art:art / runtime / runtime.cc:422] |举行mutexes =abort lock
A / art:art / runtime / runtime.cc:422] native:#00 pc 000000000047e2cc /system/lib64/libart.so(_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv + 220)
A /艺术:art / runtime / runtime.cc:422] native:#01 pc 000000000047e2c8 /system/lib64/libart.so(_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv + 216)
A / art:art / runtime / runtime.cc:422] native :#02 pc 0000000000452434 /system/lib64/libart.so(_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap + 480)
A / art:art / runtime / runtime.cc:422] native:#03 pc 00000000004403ac /system/lib64/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE + 56)
A / art:art / runtime / runtime.cc:422] native:#04 pc 0000000000440228 /system/lib64/libart.so(_ZNK3art10AbortState4DumpERNSt3__113basic_ostream IcNS1_11char_traitsIcEEEE + 668)
A / art:art / runtime / runtime.cc:422] native:#05 pc 0000000000433bfc /system/lib64/libart.so(_ZN3art7Runtime5AbortEPKc + 148)
A / art:art /runtime/runtime.cc:422] native:#06 pc 00000000000e597c /system/lib64/libart.so(_ZN3art10LogMessageD2Ev + 1592)
A / art:art / runtime / runtime.cc:422] native:#07 PC 00000000002f8458 /system/lib64/libart.so(_ZN3art4JDWP9JdwpState24AcquireJdwpTokenForEventEm + 624)
A /艺术:艺术/运行/ runtime.cc:422]天然:#08 PC 00000000002f7b1c /system/lib64/libart.so(_ZN3art4JDWP9JdwpState29SendRequestAndPossiblySuspendEPNS0_9ExpandBufENS0_17JdwpSuspendPolicyEm + 248)
A / art:art / runtime / runtime.cc:422] native:#09 pc 00000000002fcb08 /system/lib64/libart.so(_ZN3art4JDWP9JdwpState16PostClassPrepareEPNS_6mirror5ClassE + 1380)
A / art:art / runtime /runtime.cc:422] native:#10 pc 0000000000124a9c /system/lib64/libart.so(_ZN3art11ClassLinker11DefineClassEPNS_6ThreadEPKcmNS_6HandleINS_6mirror11ClassLoaderE EERKNS_7DexFileERKNS9_8ClassDefE + 804)
A / art:art / runtime / runtime.cc:422] native:#11 pc 0000000000381d04 /system/lib64/libart.so(_ZN3artL25DexFile_defineClassNativeEP7_JNIEnvP7_jclassP8_jstringP8_jobjectS7_S7_ + 344)
A / art:art /runtime/runtime.cc:422] native:#12 pc 00000000001dd40c /system/framework/arm64/boot-core-libart.oat(???)
A / art:art / runtime / runtime.cc: 422]在dalvik.system.DexFile.defineClassNative(本机方法)
A / art:art / runtime / runtime.cc:422]在dalvik.system.DexFile.defineClass(DexFile.java:296)$ b $ dalvik.system.DexFile.loadClassBinaryName(DexFile.java:289)
A / art:art / runtime / runtime.cc:422]在dalvik .system.DexPathList.findClass(DexPathList.java:418)
A / art:art / runtime / runtime.cc:422]在dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
A / art:art / runtime / runtime.cc:422] at com.android.tools.fd.runtime.IncrementalClassLoader $ DelegateClassLoader.findClass(In crementalClassLoader.java:90)
A / art:art / runtime / runtime.cc:422]在com.android.tools.fd.runtime.IncrementalClassLoader.findClass(IncrementalClassLoader.java:62)
A / art:art / runtime / runtime.cc:422]在java.lang.ClassLoader.loadClass(ClassLoader.java:380)
A / art:art / runtime / runtime.cc:422]在java.lang .ClassLoader.loadClass(ClassLoader.java:367)
A / art:art / runtime / runtime.cc:422]在java.lang.ClassLoader.loadClass(ClassLoader.java:367)
A /艺术:art / runtime / runtime.cc:422]在java.lang.ClassLoader.loadClass(ClassLoader.java:312)
A / art:art / runtime / runtime.cc:422]无需适当地转储所有线程锁定:线程列表锁定mutator锁


解决方案

经过相当的修补,我发现了这个问题。对我来说,发生在我在嵌套函数中有一个断点的时候。在我的情况下,它在Runnable.run(){}中。不确定是否发生在其他嵌套函数中。



示例:

  public class TouchEvent {
public boolean HandleEvent(MotionEvent Event){
new Runnable(){@Override public void run(){
int i = 5;
i ++;
}};
}
}

如果运行中的任何一行都有一个断点()func,它崩溃与错误 A / art:art / runtime / jdwp / jdwp_event.cc:661]检查失败:Thread :: Current()!= GetDebugThread()(Thread :: Current ()= 0x ########,GetDebugThread()= 0x ########)预期事件线程



第一次遇到此错误时,不会在断点被击中时发生。所以当我在TouchEvent的任何代码运行之前(在构造函数之前)进入一条具有新的TouchEvent(); 的行时。

解决方案是删除断点(并将其放在其他位置)。



忘了提,似乎被绑定到API25


When I run in debug mode the app crashes, but when I just run it normally it works. I think the problem happens when the debugger is attached.

Log:

A/art: art/runtime/jdwp/jdwp_event.cc:661] Check failed: Thread::Current() != GetDebugThread() (Thread::Current()=0x7f44a18400, GetDebugThread()=0x7f44a18400) Expected event thread
A/art: art/runtime/runtime.cc:422] Runtime aborting...
A/art: art/runtime/runtime.cc:422] Aborting thread:
A/art: art/runtime/runtime.cc:422] "JDWP" prio=5 tid=4 WaitingForDebuggerSend
A/art: art/runtime/runtime.cc:422]   | group="" sCount=0 dsCount=0 obj=0x12c60280 self=0x7f44a18400
A/art: art/runtime/runtime.cc:422]   | sysTid=24137 nice=0 cgrp=default sched=0/0 handle=0x7f4b904450
A/art: art/runtime/runtime.cc:422]   | state=R schedstat=( 132066712 16401043 106 ) utm=9 stm=2 core=3 HZ=100
A/art: art/runtime/runtime.cc:422]   | stack=0x7f4b80a000-0x7f4b80c000 stackSize=1005KB
A/art: art/runtime/runtime.cc:422]   | held mutexes= "abort lock"
A/art: art/runtime/runtime.cc:422]   native: #00 pc 000000000047e2cc  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+220)
A/art: art/runtime/runtime.cc:422]   native: #01 pc 000000000047e2c8  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+216)
A/art: art/runtime/runtime.cc:422]   native: #02 pc 0000000000452434  /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+480)
A/art: art/runtime/runtime.cc:422]   native: #03 pc 00000000004403ac  /system/lib64/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+56)
A/art: art/runtime/runtime.cc:422]   native: #04 pc 0000000000440228  /system/lib64/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+668)
A/art: art/runtime/runtime.cc:422]   native: #05 pc 0000000000433bfc  /system/lib64/libart.so (_ZN3art7Runtime5AbortEPKc+148)
A/art: art/runtime/runtime.cc:422]   native: #06 pc 00000000000e597c  /system/lib64/libart.so (_ZN3art10LogMessageD2Ev+1592)
A/art: art/runtime/runtime.cc:422]   native: #07 pc 00000000002f8458  /system/lib64/libart.so (_ZN3art4JDWP9JdwpState24AcquireJdwpTokenForEventEm+624)
A/art: art/runtime/runtime.cc:422]   native: #08 pc 00000000002f7b1c  /system/lib64/libart.so (_ZN3art4JDWP9JdwpState29SendRequestAndPossiblySuspendEPNS0_9ExpandBufENS0_17JdwpSuspendPolicyEm+248)
A/art: art/runtime/runtime.cc:422]   native: #09 pc 00000000002fcb08  /system/lib64/libart.so (_ZN3art4JDWP9JdwpState16PostClassPrepareEPNS_6mirror5ClassE+1380)
A/art: art/runtime/runtime.cc:422]   native: #10 pc 0000000000124a9c  /system/lib64/libart.so (_ZN3art11ClassLinker11DefineClassEPNS_6ThreadEPKcmNS_6HandleINS_6mirror11ClassLoaderEEERKNS_7DexFileERKNS9_8ClassDefE+804)
A/art: art/runtime/runtime.cc:422]   native: #11 pc 0000000000381d04  /system/lib64/libart.so (_ZN3artL25DexFile_defineClassNativeEP7_JNIEnvP7_jclassP8_jstringP8_jobjectS7_S7_+344)
A/art: art/runtime/runtime.cc:422]   native: #12 pc 00000000001dd40c  /system/framework/arm64/boot-core-libart.oat (???)
A/art: art/runtime/runtime.cc:422]   at dalvik.system.DexFile.defineClassNative(Native method)
A/art: art/runtime/runtime.cc:422]   at dalvik.system.DexFile.defineClass(DexFile.java:296)
A/art: art/runtime/runtime.cc:422]   at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:289)
A/art: art/runtime/runtime.cc:422]   at dalvik.system.DexPathList.findClass(DexPathList.java:418)
A/art: art/runtime/runtime.cc:422]   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
A/art: art/runtime/runtime.cc:422]   at com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader.findClass(IncrementalClassLoader.java:90)
A/art: art/runtime/runtime.cc:422]   at com.android.tools.fd.runtime.IncrementalClassLoader.findClass(IncrementalClassLoader.java:62)
A/art: art/runtime/runtime.cc:422]   at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
A/art: art/runtime/runtime.cc:422]   at java.lang.ClassLoader.loadClass(ClassLoader.java:367)
A/art: art/runtime/runtime.cc:422]   at java.lang.ClassLoader.loadClass(ClassLoader.java:367)
A/art: art/runtime/runtime.cc:422]   at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
A/art: art/runtime/runtime.cc:422] Dumping all threads without appropriate locks held: thread list lock mutator lock

解决方案

After considerable tinkering, I found the problem. For me, it occurred when I have a breakpoint in a nested function. In my case, it was within Runnable.run() {}. Not sure if it happens in other nested functions.

Example:

public class TouchEvent {
    public boolean HandleEvent(MotionEvent Event) {
        new Runnable() { @Override public void run() {
            int i=5;
            i++;
        }};
    }
}

If there is a breakpoint on any line inside the run() func, it crashes with the error A/art: art/runtime/jdwp/jdwp_event.cc:661] Check failed: Thread::Current() != GetDebugThread() (Thread::Current()=0x########, GetDebugThread()=0x########) Expected event thread .

This error occurs the first time the class is encountered, NOT when the breakpoint is hit. So it occurred for me when I stepped into a line that had new TouchEvent();, before any of the TouchEvent's code was run (before the constructor).

The solution is to remove the break point (and put it elsewhere).

[Edit] Forgot to mention, it seems to be tied to API25

这篇关于Android应用程序在调试模式下启动时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆