简体   繁体   English

在 Android Studio 中分离调试器

[英]Detach debugger in Android Studio

In Android Studio, how do you detach the debugger once it's connected and debugging a running app?在 Android Studio 中,一旦调试器连接并调试正在运行的应用程序,您如何分离它?

In Eclipse, the icon looked like this在 Eclipse 中,图标看起来像这样 . .

I've been disconnecting the USB cable but that seems like a brute method.我一直在断开 USB 电缆,但这似乎是一种粗暴的方法。

The answer is the Close button.答案是关闭按钮。 As of Android Studio v3.4 it's a red square block icon (previously was a red X).从 Android Studio v3.4 开始,它是一个红色方块图标(以前是红色 X)。

It turns out I couldn't see it because it was hidden under the more >> icon.原来我看不到它,因为它隐藏在更多>>图标下。

I'm writing this assuming that Android Studio uses the same convention as IntelliJ IDEA .我写这篇文章是假设 Android Studio 使用与 IntelliJ IDEA 相同的约定

Click "close" (the button with the red ✕ in the debug panel):点击“关闭”(调试面板中带有红色✕的按钮):

在此处输入图像描述

You will be prompted.系统会提示您。 Choose whether to disconnect and/or terminate:选择是否断开连接和/或终止:

在此处输入图像描述

In case the X (Close) button is not shown because it is collapsed in the toolbar:如果X (关闭)按钮因为折叠在工具栏中而未显示:

1. Resize the Debugger window to see the X button 1. 调整 Debugger 窗口大小以查看X按钮


OR或者

2. Press CTRL + F4 (CMD + F4 on MAC). 2. 按CTRL + F4 (MAC 上的 CMD + F4)。


OR或者

3. Right click on the Debugger Tab and select Close . 3. 右键单击​​调试器选项卡并选择关闭


Then press Disconnect in the Dialog.然后在对话框中按断开连接

On android studio 3.3.1 I also can't find an easy way to disconnect the emulator.在 android studio 3.3.1 上,我也找不到断开模拟器的简单方法。 I've resorted to the terminal command adb kill-server (use adb start-server to start it again)我使用了终端命令adb kill-server (使用adb start-server再次启动它)

In newer versions of Android Studio, the (X) Close button in the sidebar no longer exists.在较新版本的 Android Studio 中,边栏中的 (X) 关闭按钮不再存在。 If that is your case and you want to detach the debugger from Android Studio, you can tap the "X" in the tab at the top of the debugging window that says "Android Debugger (XXXX)"如果这是您的情况,并且您想从 Android Studio 中分离调试器,您可以点击调试窗口顶部选项卡中显示“Android 调试器 (XXXX)”的“X”

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM