热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

无法将AndroidStudio的调试器附加到Android进程中?-Can'tattachAndroidStudio'sdebuggertoAndroidprocess

IcantattachAndroidStudiosdebuggertomydebuggableapplicationprocess.Anyoneelsehadthis

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 Studio的调试器附加到我的调试应用程序中。还有人有这个问题吗?基本上,我无法让我的应用程序在选择过程对话框中列出。

I'm selecting Attach debugger to Android process:

我正在选择附加调试器到Android程序:

Attach debugger to Android process

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

下面是Android Studio的过程选择对话框的样子:

No app is in the list to be debugged

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

为什么我的应用程序没有显示在选择过程列表中?

Although, DDMS sees my app in Devices | logcat list:

虽然,DDMS在设备| logcat列表中看到了我的应用:

<code>Devices | logcat</code> list

Android Monitor also sees the app in Devices list:

安卓显示器也可以在设备列表中看到应用程序:

Android Monitor | Devices list

I've tried these actions:

我试过这些操作:

  • Restarting MacBook
  • 重新启动电脑
  • Restarting devices: tried with Samsung Galaxy Note II N7100 (4.3) and Samsung Galaxy S4 (4.4.2)
  • 重启设备:试用三星Galaxy Note II N7100(4.3)和三星Galaxy S4 (4.4.2)
  • Reenabling Settings->Developer Options on the devices
  • 重新启用设置-设备上的>开发者选项。
  • Reenabling Settings->Developer Options->USB debugging on the devices
  • 重新启用设置->开发者选项->在设备上的USB调试。
  • Restarting adb by running adb kill-server and adb start-server
  • 通过运行adb kill-server和adb启动服务器重新启动adb。
  • Reconnecting device from macbook and/or plugging to another USB port
  • 从macbook重新连接设备,或插入到另一个USB端口。
  • Launching Genymotion virtual device on macbook
  • 在macbook上启动Genymotion虚拟设备。
  • restarting in TCP mode port: 5555 by running adb tcpip 5555 and then connecting to it with adb connect 192.168.1.87
  • 重新启动TCP模式端口:5555通过运行adb tcpip 5555,然后与adb连接,连接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
  • 当出现这个错误时,等待更多的时间,表示ADB没有响应。您可以等待更多,或者手动删除adb进程,在adb中单击“重启”错误:ddms:“$ANDROID_HOME/平台工具/adb,start-server”失败——如果必要的错误截图,请手动运行。

Update:

更新:

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.

我注意到,在Android DDMS->设备| logcat列表中,设备出现了多次。如果我从列表中选择第一个设备,它显示,没有可调试的应用程序,但是我选择了最后一个设备(屏幕截图中的第4个),我看到了我的可调试应用程序。见截图:1和4。尽管在列表中只有一个设备,显示可调试的设备和应用程序,但是进程仍然没有出现在选择过程对话框中。

7 个解决方案

#1


21  

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:

综上所述,这些是要做的其他事情:

  • Kill all adb processes (use ps -x | grep adb and kill -9 [process id])
  • 删除所有adb进程(使用ps -x | grep adb和Kill -9[进程id])
  • adb start-server in terminal
  • 亚行在终端启动服务器
  • Reconnect device
  • 重新连接设备
  • adb devices (to make sure device is connected successfully)
  • adb设备(确保设备连接成功)
  • Make sure Android DDMS Devices | logcat shows your app and only one device is listed.
  • 确保Android DDMS设备的| logcat显示你的应用程序,并且只列出一个设备。
  • Check Show all processes checkbox. See screenshot
  • 检查显示所有进程复选框。看到截图

#2


14  

I solved this way

我解决了这个方法

a. Closed Android Studio
b. Did adb kill-server from a terminal. Also check the adb process in also killed from the Running processes window in PC
c. Started Android Studio
d. Android Studio tried to initialize adb again and back to work.

a.关闭的Android Studio b. adb kill-server来自一个终端。同时也检查了在PC c运行过程窗口中被杀的adb进程,启动了Android Studio d. Android Studio尝试再次初始化adb,然后重新开始工作。

#3


7  

This is what worked for me and its simple, go to Tools->Android->Enable ADB Integration, click on this and mark it selected if not selected this will allow your genymotion instance to connect to ADB but if this doesnt work then, if above mentioned setting is selected then mark unselected and wait till ADB is refreshed( few seconds) then again go to same setting and click on it to mark is selected, this will restart ADB and connect it. This works perfect for me each time i see this issue.

这就是为我工作及其简单,去工具- > Android - >使亚行集成,点击这个和马克如果不选择这将允许你选择genymotion实例连接到亚行但如果这并不工作,如果上述设置选中然后马克没有等到亚行刷新(几秒钟)然后再去相同的设置,点击选择标记,这将重启ADB和连接。每次我看到这个问题的时候,它都非常适合我。

#4


2  

last time i had a similar problem, maybe it's because the 'release' build Variant(which you can set in the Build Variants section)been chosen mistakenly, only debug variant is debuggable, hope this can be helpful to some friends

上次我遇到了类似的问题,可能是因为“release”构建版本(您可以在build变体部分中设置)被错误地选择,只有调试变体是可调试的,希望这对一些朋友是有帮助的。

#5


0  

In addition to all answers before, If you add breakpoints that evaluate and log, may be one of them cause Null Pointer exception. So go to run -> viewBreakpoints... -> unselect all of them.

除了前面所有的答案之外,如果您添加评估和日志的断点,可能是其中一个导致空指针异常。所以去运行-> viewBreakpoints…->取消所有选项。

#6


0  

You do not have to close android studio as I have seen many advise, you can use the terminal from here. In this way : 1 Go to the terminal in Android studio; 2 Did adb kill-server to kill the process; 3 Did adb start-server to running here 4. Check if the devices is attached with adb devices

您不必关闭android studio,因为我已经看到许多建议,您可以在这里使用终端。这样:1到Android studio的终端;2 adb kill-server终止进程;adb启动服务器在这里运行吗?检查设备是否与adb设备连接。

Now it should work !

现在它应该工作了!

#7


0  

I solved this by going to a terminal and doing:

我通过一个终端来解决这个问题:

  • adb kill-server
  • 亚行kill-server
  • adb start-server
  • 亚洲开发银行启动服务器

Then I clicked in the "attach debugger" button and I could use it as normal

然后我点击“附加调试器”按钮,我可以正常使用它。


推荐阅读
  • 计算机存储系统的层次结构及其优势
    本文介绍了计算机存储系统的层次结构,包括高速缓存、主存储器和辅助存储器三个层次。通过分层存储数据可以提高程序的执行效率。计算机存储系统的层次结构将各种不同存储容量、存取速度和价格的存储器有机组合成整体,形成可寻址存储空间比主存储器空间大得多的存储整体。由于辅助存储器容量大、价格低,使得整体存储系统的平均价格降低。同时,高速缓存的存取速度可以和CPU的工作速度相匹配,进一步提高程序执行效率。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 本文详细介绍了Spring的JdbcTemplate的使用方法,包括执行存储过程、存储函数的call()方法,执行任何SQL语句的execute()方法,单个更新和批量更新的update()和batchUpdate()方法,以及单查和列表查询的query()和queryForXXX()方法。提供了经过测试的API供使用。 ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • IhaveconfiguredanactionforaremotenotificationwhenitarrivestomyiOsapp.Iwanttwodiff ... [详细]
  • 目录实现效果:实现环境实现方法一:基本思路主要代码JavaScript代码总结方法二主要代码总结方法三基本思路主要代码JavaScriptHTML总结实 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • http:my.oschina.netleejun2005blog136820刚看到群里又有同学在说HTTP协议下的Get请求参数长度是有大小限制的,最大不能超过XX ... [详细]
  • 本文介绍了Android 7的学习笔记总结,包括最新的移动架构视频、大厂安卓面试真题和项目实战源码讲义。同时还分享了开源的完整内容,并提醒读者在使用FileProvider适配时要注意不同模块的AndroidManfiest.xml中配置的xml文件名必须不同,否则会出现问题。 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • javascript  – 概述在Firefox上无法正常工作
    我试图提出一些自定义大纲,以达到一些Web可访问性建议.但我不能用Firefox制作.这就是它在Chrome上的外观:而那个图标实际上是一个锚点.在Firefox上,它只概述了整个 ... [详细]
  • JavaSE笔试题-接口、抽象类、多态等问题解答
    本文解答了JavaSE笔试题中关于接口、抽象类、多态等问题。包括Math类的取整数方法、接口是否可继承、抽象类是否可实现接口、抽象类是否可继承具体类、抽象类中是否可以有静态main方法等问题。同时介绍了面向对象的特征,以及Java中实现多态的机制。 ... [详细]
  • 利用Visual Basic开发SAP接口程序初探的方法与原理
    本文介绍了利用Visual Basic开发SAP接口程序的方法与原理,以及SAP R/3系统的特点和二次开发平台ABAP的使用。通过程序接口自动读取SAP R/3的数据表或视图,在外部进行处理和利用水晶报表等工具生成符合中国人习惯的报表样式。具体介绍了RFC调用的原理和模型,并强调本文主要不讨论SAP R/3函数的开发,而是针对使用SAP的公司的非ABAP开发人员提供了初步的接口程序开发指导。 ... [详细]
  • 本文介绍了在mac环境下使用nginx配置nodejs代理服务器的步骤,包括安装nginx、创建目录和文件、配置代理的域名和日志记录等。 ... [详细]
author-avatar
nora抹抹茶I
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有