android studio 无法连接到调试设备
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21745143/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
android studio can't connect to debug devices
提问by SamuraiSong
Android Studio can't connect to debug devices.
Android Studio 无法连接到调试设备。
When I click the debug button, the debug tab shows me
当我单击调试按钮时,调试选项卡会显示我
Connecting to the target VM, address: 'localhost:8600', transport: 'socket'
in variables
在变量中
When I tried again it told me
当我再次尝试时它告诉我
12:14:44 Error running Android Debugger (8600): Unable to open debugger port : java.io.IOException "handshake failed - connection prematurely closed"
and then debug tab show me this
然后调试选项卡给我看这个
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'
in variables
在变量中
My Android Studio version is 0.4.4 #AI133-1005886
我的 Android Studio 版本是 0.4.4 #AI133-1005886
This problem has been haunting me for a long time.
这个问题困扰我很久了。
i use OS X
我使用 OS X
采纳答案by 5er
Well, what it worked for me: I have change my /etc/hosts file and make sure that those 3 lines are on the bottom of the file:
好吧,它对我有用:我更改了我的 /etc/hosts 文件并确保这 3 行位于文件的底部:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
回答by dvrm
in android studio: tools->android->enable adb integration(this should be checked) uncheck this, then check again.this solved me this problem. (it restarts the adb integration)
在android studio中:工具->android->启用adb集成(这应该被选中)取消选中这个,然后再次检查。这解决了我这个问题。(它重新启动 adb 集成)
回答by Silmaril
This is how I solved same issue:
这就是我解决相同问题的方法:
1) I don't think that it is important but I: updated all pending for update ADT stuff. And restarted OS. But I still was unable to debug
1)我认为这并不重要,但我:更新了所有待更新的 ADT 内容。并重新启动操作系统。但是我还是无法调试
2) Next: I launched AS. Opened terminal and ran this:
2)下一步:我启动了AS。打开终端并运行:
./adb get-state
- daemon not running. starting it now on port 5037 *
- daemon started successfully *
- 守护进程没有运行。现在在端口 5037 上启动它 *
- 守护进程成功启动 *
As you can see daemon started automatically after I asked for its state. So I did not do nothing more. Just tried to debug and this time debugging worked.
正如您所看到的,守护进程在我询问其状态后自动启动。所以我没有再做什么。刚刚尝试调试,这次调试成功了。
P.S. After I restarted AS debugging continued working. So there was no need in terminal manipulations anymore
PS 在我重新启动 AS 调试后继续工作。所以不再需要终端操作了
回答by dong wei
This is how I solved same issue: (1)remove or disconnect your phone ! (2) connect your phone again!
这就是我解决相同问题的方法:(1)移除或断开您的手机!(2) 再次连接手机!
回答by Islam Salah
回答by Andrey Aleev
I faced this error too. I had to disable Instant Runto get the Debugger working.
我也遇到了这个错误。我必须禁用 Instant Run才能使调试器正常工作。
回答by qwlice
If none of the other solutions worked for you (as it didn't for me), I suggest to try to do a clean reinstall of the Platform tools.
如果其他解决方案都不适合您(因为它不适合我),我建议尝试重新安装 Platform tools。
1 - Start the standalone SDK Manager.
1 - 启动独立的SDK 管理器。
From Android Studio: Tools->Android->SDK manager, SDK Tools tab, click start standalone SDK manager.
从 Android Studio:工具->Android->SDK 管理器,SDK 工具选项卡,单击启动独立 SDK 管理器。
2 - Close Android Studio.
2 - 关闭 Android Studio。
3 - In SDK manager, in the Tools folder: check Android SDK Platform-Toolsand click on the Delete packagesbutton in bottom right corner.
3 - 在SDK manager的Tools 文件夹中:选中Android SDK Platform-Tools并单击右下角的Delete packages按钮。
4 - In Explorer, delete the folder android-sdk-path\platform-tools.
4 - 在资源管理器中,删除文件夹 android-sdk-path\platform-tools。
5 - Back in SDK manager: re-check Android SDK Platform-Toolsand click on the Install packagesbutton.
5 - 返回SDK 管理器:重新检查Android SDK Platform-Tools并单击Install packages按钮。
回答by bob
In a Windows environment, I brought up Taskmgr and it showed many copies of the debugger running. Shutting down Android Studio and restarting it solved the problem.
在 Windows 环境中,我打开了 Taskmgr,它显示了许多正在运行的调试器副本。关闭Android Studio并重新启动它解决了问题。
回答by Kiko Seijo
What worked for me was install all new tools:
对我有用的是安装所有新工具:
- LLDB 2.3 (lldb;2.3)
- CMake 3.6.3155560 (cmake;3.6.3155560)
- GPU Debugging tools (extras;android;gapid;3)
- Instant Apps Development SDK (extras;google;instantapps)
- LLDB 2.3 (lldb;2.3)
- CMake 3.6.3155560 (cmake;3.6.3155560)
- GPU 调试工具 (extras;android;gapid;3)
- Instant Apps 开发 SDK(附加功能;google;instantapps)
Hope it helps anyone.
希望它可以帮助任何人。
回答by changhao cui
in my case i edited etc/hosts's everything goes wrong.
就我而言,我编辑了 etc/hosts 的一切都出错了。
clear files /etc/hosts debug work.
清除文件 /etc/hosts 调试工作。