当我尝试附加 Android Studio 调试器时,我的一些应用程序崩溃了,然后我收到此错误:
Disconnected from the target VM, address: 'localhost:8602', transport: 'socket'
我尝试重新启动 Windows、Android Studio 和 My Nexus,但没有任何效果。
我正在使用最新版本的 Android SDK、构建工具...
这次崩溃后的部分日志:
01-16 09:08:26.967 18208-18213/? A/art: art/runtime/runtime.cc:422] Runtime aborting...
01-16 09:08:26.967 18208-18213/? A/art: art/runtime/runtime.cc:422] Aborting thread:
01-16 09:08:26.967 18208-18213/? A/art: art/runtime/runtime.cc:422] "Jit thread pool worker thread 0" prio=5 tid=2 WaitingForDebuggerSend (still starting up)
01-16 09:08:26.967 18208-18213/? A/art: art/runtime/runtime.cc:422] | group="" sCount=0 dsCount=0 obj=0x0 self=0xec00d000
01-16 09:08:26.967 18208-18213/? A/art: art/runtime/runtime.cc:422] | sysTid=18213 nice=9 cgrp=default sched=0/0 handle=0xf2aa5920
01-16 09:08:26.967 18208-18213/? A/art: art/runtime/runtime.cc:422] | state=R schedstat=( 2419166052 199636564 1513 ) utm=213 stm=28 core=5 HZ=100
01-16 09:08:26.967 18208-18213/? A/art: art/runtime/runtime.cc:422] | stack=0xf29a7000-0xf29a9000 stackSize=1022KB
01-16 09:08:26.967 18208-18213/? A/art: art/runtime/runtime.cc:422] | held mutexes= "abort lock"
最佳答案
我在 Mac 上的 Android Studio 3.0 中遇到了完全相同的问题。解决方案来自this answer ,基本上你需要禁用即时运行(即使我没有使用它):
在 Mac OS X 下:
- 安卓工作室
- 偏好
- 构建、执行、部署
- 即时运行
- 取消选中“启用即时运行以进行热插拔...”。
有一个“在使用 Instant Run 时遇到问题?”设置面板中显示的消息。我单击“重新启用并激活额外的日志记录”,重现了崩溃,然后立即按照他们的要求使用“帮助 - 报告即时运行问题...”选项进行了报告。
关于Android 应用程序在尝试附加调试器时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41658723/