无法将 Android Studio 的调试器附加到 Android 进程 [英] Can't attach Android Studio's debugger to Android process

查看:55
本文介绍了无法将 Android Studio 的调试器附加到 Android 进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法将 Android Studio 的调试器附加到我的可调试应用程序进程中.其他人有这个问题吗?基本上我无法在 Choose Process 对话框中列出我的应用程序.

I can't attach Android Studio's debugger to my debuggable application process. Anyone else had this issue? Basically I can't get my app listed in Choose Process dialog.

我选择将调试器附加到Android进程:

然后,Android Studio 中的 Process selection 对话框如下所示:

And then, here's how Process selection dialog from Android Studio looks like:

有什么想法为什么我的应用没有显示在 Choose Process 列表中?

Any ideas why my app is not shown in the Choose Process list?

尽管 DDMSDevices | 中看到了我的应用程序logcat 列表:

Android Monitor 还可以在 Devices 列表中看到该应用:

Android Monitor also sees the app in Devices list:

我已经尝试过这些操作:

I've tried these actions:

  • 重启MacBook
  • 重启设备:尝试使用 Samsung Galaxy Note II N7100 (4.3) 和 Samsung Galaxy S4 (4.4.2)
  • 在设备上重新启用 Settings->Developer Options
  • 在设备上重新启用 Settings->Developer Options->USB debugging
  • 通过运行adb kill-serveradb start-server
  • 重新启动adb
  • 从 macbook 重新连接设备和/或插入另一个 USB 端口
  • 在 macbook 上启动 Genymotion 虚拟设备
  • 在 TCP 模式端口重新启动:5555 通过运行 adb tcpip 5555 然后使用 adb connect 192.168.1.87 连接到它
  • Waiting more&Restart 当收到这个错误时说 ADB 没有响应.您可以等待更多,或手动终止adb"进程并单击重新启动" Errors in ADB: ddms: '$ANDROID_HOME/platform-tools/adb,start-server' 失败 -- 必要时手动运行 错误截图
  • Restarting MacBook
  • Restarting devices: tried with Samsung Galaxy Note II N7100 (4.3) and Samsung Galaxy S4 (4.4.2)
  • Reenabling Settings->Developer Options on the devices
  • Reenabling Settings->Developer Options->USB debugging on the devices
  • Restarting adb by running adb kill-server and adb start-server
  • Reconnecting device from macbook and/or plugging to another USB port
  • Launching Genymotion virtual device on macbook
  • restarting in TCP mode port: 5555 by running adb tcpip 5555 and then connecting to it with adb connect 192.168.1.87
  • Waiting more&Restart when got this error saying ADB not responding. You can wait more, or kill "adb" process manually and click 'Restart' Errors in ADB: ddms: '$ANDROID_HOME/platform-tools/adb,start-server' failed -- run manually if necessary Error screenshot

更新:

我注意到设备在 Android DDMS->Devices | 中多次出现.logcat 列表.如果我从列表中选择第一个设备,它会显示 No debuggable applications,但我选择了最后一个设备(屏幕截图中的第 4 个)我看到了我的可调试应用程序.查看屏幕截图:1st第四.虽然,即使列表中只有 1 个设备并显示可调试的设备和应用程序,进程仍然没有出现在 Choose Process 对话框中.

What I've noticed is that device appears multiple times in the Android DDMS->Devices | logcat list. If I choose 1st device from the list, it shows, there's No debuggable applications, but I select last device (4th in the screenshot) I see my debuggable application. See screenshots: 1st and 4th. Although, even there's only 1 device in the list and showing debuggable device and application, process still does not appear in the Choose Process dialog.

推荐答案

所以我终于搞定了,作者:

So finally I got it working, by:

Checking 'Show all processes' checkbox!

但是正如您在问题中看到的,复选框在开始时处于启用状态,因此存在多个问题.

BUT as you see in the question, checkbox was on at the beginning, so there were multiple issues.

总而言之,以下是需要完成的其他操作:

To summarize, these are other actions to be done:

  • 杀死所有 adb 进程(使用 ps -x | grep adbkill -9 [process id])
  • adb start-server 在终端
  • 重新连接设备
  • adb devices(确保设备连接成功)
  • 确保Android DDMS Devices |logcat 显示您的应用,并且仅列出一台设备.
  • 选中显示所有进程复选框.看截图
  • Kill all adb processes (use ps -x | grep adb and kill -9 [process id])
  • adb start-server in terminal
  • Reconnect device
  • adb devices (to make sure device is connected successfully)
  • Make sure Android DDMS Devices | logcat shows your app and only one device is listed.
  • Check Show all processes checkbox. See screenshot

这篇关于无法将 Android Studio 的调试器附加到 Android 进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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