Android 应用程序在尝试附加调试器时崩溃

标签 android android-studio crash

当我尝试附加 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 下:

  1. 安卓工作室
  2. 偏好
  3. 构建、执行、部署
  4. 即时运行
  5. 取消选中“启用即时运行以进行热插拔...”。

有一个“在使用 Instant Run 时遇到问题?”设置面板中显示的消息。我单击“重新启用并激活额外的日志记录”,重现了崩溃,然后立即按照他们的要求使用“帮助 - 报告即时运行问题...”选项进行了报告。

关于Android 应用程序在尝试附加调试器时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41658723/

相关文章:

android - 如何修复 Android 中有关数组数组的内存泄漏?

android - 主线程被Object.wait自己阻塞?

java - Android Studio 错误 :Class android. support.v4.hardware.display.DisplayManagerCompat 已添加到输出中。请删除重复的副本

c++ - 0xC0000005 : Access violation writing location 0xCCCCCCCC caused by trying to make safe empty chars

c++ - 在同一台机器上编译的相同 C++ 代码表现不同

java - 在文本字段中输入后如何隐藏 EditText 错误?

android - BOOT_COMPLETE 和 ExternalStorageState

android - 如何在 Android Studio 中使用断言

Android Studio-未使用的import-com.google.android.gcm.GCMBaseIntentService;

java - 尝试创建新的 EditText 后 setcontentview 使应用程序崩溃