无法在Android Studio 2.3.3中将调试器附加到Android进程 [英] Unable to attach debugger to Android process in Android Studio 2.3.3

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

问题描述

我已经在互联网上搜索并尝试了遇到的所有问题,但是我无法弄清楚自己在做什么错.我无法在Android Studio中将调试器附加到我的Android进程.

I have searched the internet and tried everything I have come across, but I cannot figure out what I am doing wrong. I cannot attach the debugger to my Android process in Android Studio.

我已经在使用VirtualBox并运行Ubuntu 16.04.2.的虚拟机上的Android Studio 2.3.3中构建了一个应用程序.我已经在应用程序Getac Data Logger上安装了该应用程序,并且注意到我的应用程序打开了几秒钟,显示了空白的白屏,然后崩溃了.因此,我尝试在设备上调试该应用程序以查找问题.当我单击将调试器附加到Android进程"图标时,可以看到我的设备是一个选项,但是,当我选择我的设备时,确定"按钮显示为灰色.我没有办法继续进行此过程.有时会弹出警告调试信息可能不可用,请使用ADB关闭其他应用程序:Monitor,DDMS,Eclipse",但并非每次都弹出.

I have built an app in Android Studio 2.3.3 on a virtual machine using VirtualBox and running Ubuntu 16.04.2. I have installed the app on my device, a Getac Data Logger, and have noticed that my app opens for a couple of seconds, displaying a blank white screen, and then crashes. So, I have attempted to debug the app on my device to find the problem. When I click on the "Attach debugger to Android process" icon, I can see my device as an option, however, when I select my device the OK button is grayed out. There is no way for me to move forward with this process. Sometimes the warning "debug info can be unavailable, please close other application using ADB: Monitor, DDMS, Eclipse" pops up, but not every time.

有人对我所缺少的东西有任何想法吗?它与在虚拟机上工作的局限性有关吗?

Does anyone have any ideas as to what I am missing? Does it have something to do with the limitations of working on a virtual machine?

我尝试过的事情:

  • 确保已允许在设备上进行USB调试

  • Making sure I have allowed USB debugging on my device

选择显示所有进程的所有组合/auto/java/etc

Selecting all kinds of combinations of show all processes/auto/java/etc

命令:adb kill-server,然后adb start-server; adb kill-server,然后adb -P 5038 start-server

Commands: adb kill-server, then adb start-server; adb kill-server, then adb -P 5038 start-server

等待插入设备,直到启动调试器附件

Waiting to plug in my device until I launch the debugger attachment

构建调试变体

在我的AndroidManifest.xml中向我的应用程序添加android:debuggable ="true",然后在构建调试变体并将其撤回后注意到没有必要

Adding android: debuggable="true" to my application in my AndroidManifest.xml, then noticing it was not necessary after building the debug variant and taking it back out

通过Tools/Android/启用ADB集成来禁用和重新启用ADB集成

Disabling and re-enabling the ADB integration through Tools/Android/Enable ADB integration

关闭Android Studio,然后再次将其打开

Closing Android Studio and then opening it again

更改adb端口

无效的缓存/重新启动

卸载应用程序,清理构建,然后重新安装应用程序

Uninstalling the app, clean build, reinstalling the app

使用以下命令安装MTP:apt-get install mtpfs.它说mtpfs已经是最新版本,但是Ubuntu错误无法打开MTP设备'[usb:001,021]'"确实存在,但并非总是如此.

Installing the MTP using the command: apt-get install mtpfs. It says that mtpfs is already the newest version, but the Ubuntu error "Unable to open MTP device '[usb:001,021]'" does persist, just not always.

撤销USB调试授权,退出Android Studio和VirtualBox,重新启动所有内容,然后重新进行设置.

Revoking USB debugging authorizations, exiting out of Android Studio and my VirtualBox, rebooting everything, and setting it all up again.

请注意:

  • 我是开发新手(一年多的Web开发经验),是应用开发新手(这是我创建的第一个应用程序),还是Android Studio的新手(再次,非常第一个应用).

  • I am brand new to development (a little over a year experience in web development), brand new to app development (this is the very first app I am creating), brand new to Android Studio (again, very first app).

我的设备作为选项显示在调试器中.只是确定"按钮显示为灰色,无法前进.

My device is showing up in the debugger as an option. It is just that the OK button is grayed out, no way to move forward.

我没有运行Eclipse或Monitor(因此也没有DDMS).

I do NOT have Eclipse or Monitor (and therefore not DDMS either) running.

我注意到#com.android.ddmlib-Adb拒绝与客户端'[数字]'的连接:已关闭"在我的终端中以几种不同的数字组合显示了好几次.不知道这意味着什么.也许我正在运行DDMS?我以为那是Monitor运行的东西?

I have noticed that "#com.android.ddmlib - Adb rejected connection to client '[numbers]': closed" is showing up in my terminal several times with several different number combinations. Not sure what this means. Perhaps I am running DDMS? I thought that was something that runs through Monitor?

推荐答案

我关闭了IDE并且只打开了android studio之后,我同时打开了intellij Idea IDE和Android Studio 4 Canary,同时打开了Android项目.能够将调试器附加到应用程序进程.

I had intellij Idea IDE and Android Studio 4 Canary were open with Android projects at the same time, after closing both the IDEs and opening only android studio, I was able to attach the debugger to the app process.

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

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