Java adb 无法在 tcp:5037 连接到守护程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43131020/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 00:42:50  来源:igfitidea点击:

adb cannot connect to daemon at tcp:5037

javaandroidgoogle-mapsadb

提问by teacher-too

My adb can't connect devices. I am runing adb start-server

我的 adb 无法连接设备。我在跑步adb start-server

    ulucudeMacBook-Pro:~ ulucu$ adb start-server
    * daemon not running. starting it now at tcp:5037 *
    * daemon started successfully *

Then run "lsof -i tcp:5037"

然后运行“ lsof -i tcp:5037

    ulucudeMacBook-Pro:~ ulucu$ lsof -i tcp:5037
    COMMAND  PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    adb     2308 ulucu    7u  IPv4 0x440443a862048a7b      0t0  TCP localhost:5037 (LISTEN)

But when I run adb kill-server

但是当我跑 adb kill-server

    ulucudeMacBook-Pro:~ ulucu$ adb kill-server
    * server not running *

or run adb devicesor adb shell

或运行adb devicesadb shell

    List of devices attached
    * daemon not running. starting it now at tcp:5037 *
    adb E 03-31 09:30:26  2350 95705 usb_osx.cpp:333] Could not open interface: e00002c5
    adb E 03-31 09:30:26  2350 95705 usb_osx.cpp:294] Could not find device interface
    error: could not install *smartsocket* listener: Address already in use
    ADB server didn't ACK
    * failed to start daemon *
    error: cannot connect to daemon

The adb has been running.
No other processes using "5037" port.
No other simulator like "genymotion".
My system is Mac 10.12.14.
My adb version is 1.0.39.

adb 一直在运行。
没有其他进程使用“5037”端口。
没有其他模拟器像“genymotion”。
我的系统是 Mac 10.12.14。
我的 adb 版本是 1.0.39。

What's the problem?

有什么问题?

回答by abielita

Based from this thread, you cannot connect because the address is already in use. You may try busybox netstat -antpto check who is using the port. Here's another workaroung which might help:

基于此线程,您无法连接,因为该地址已被使用。您可以尝试busybox netstat -antp检查谁在使用该端口。这是另一个可能有帮助的解决方法:

Solve this problem on MacBookby first running the following command to list the process which is using port 5037

lsof -n -i4TCP:5037 | grep LISTEN

Then, I kill it:

kill -9 <PID>

Then, adb devicesworks!

MacBook通过首先运行以下命令列出正在使用端口的进程来解决此问题5037

lsof -n -i4TCP:5037 | grep LISTEN

然后,我杀了它:

kill -9 <PID>

然后,adb devices工作!

Hope this helps!

希望这可以帮助!

回答by Nils Fett

Same problem here on Ubuntu.

在 Ubuntu 上也有同样的问题。

nils@nils-MS-7597:~$ adb devices List of devices attached * daemon not running. starting it now at tcp:5037 * error: could not install smartsocketlistener: Address already in use ADB server didn't ACK * failed to start daemon * error: cannot connect to daemon

nils@nils-MS-7597:~$ adb devices 连接的设备列表 * 守护进程未运行。现在在 tcp:5037 上启动 * 错误:无法安装smartsocket侦听器:地址已在使用中 ADB 服务器没有确认 * 无法启动守护进程 * 错误:无法连接到守护进程

There is only adb listening on port 5037. Killing it does not help.

只有 adb 监听端口 5037。杀死它没有帮助。

Did update sdk before. Don't know if that could be the reason.

之前没有更新sdk。不知道会不会是这个原因。

But redownload android sdk solved it for me:

但是重新下载android sdk为我解决了它:

download android sdk

下载安卓sdk

wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz

wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz

tar -xvf android-sdk_r24.2-linux.tgz cd android-sdk-linux/tools

tar -xvf android-sdk_r24.2-linux.tgz cd android-sdk-linux/tools

install all sdk packages

安装所有 sdk 包

./android update sdk --no-ui

./android 更新 sdk --no-ui

回答by Sinapse

I cannot believe they totally remove the standalone sdk, they force you to install the latest platform-tools which cause this issue, and you cannot downgrade from the sdkmanager. What a shame. Anyway, just manually downgrade adb to version 1.0.36 and it should work. There is hundreds of issues like these on the internet. Sad.

我不敢相信他们完全删除了独立的 sdk,他们强迫您安装导致此问题的最新平台工具,并且您无法从 sdkmanager 降级。多可惜。无论如何,只需手动将 adb 降级到 1.0.36 版,它应该可以工作。互联网上有数百个这样的问题。伤心。

回答by vbevans94

If you have updated to Platform Tools 25.0.4(you can check running androidfrom command line) and it's not working

如果您已更新到 Platform Tools 25.0.4(您可以从命令行检查正在运行的android)并且它不起作用

Just download previous stable version e.g: https://dl.google.com/android/repository/platform-tools_r25.0.2-macosx.zip

只需下载以前的稳定版本,例如:https: //dl.google.com/android/repository/platform-tools_r25.0.2-macosx.zip

Then go to your Android SDK home directory and replace platform-tools folder with the downloaded one.

然后转到您的 Android SDK 主目录并将 platform-tools 文件夹替换为下载的文件夹。

Then do:

然后做:

ps aux | grep 5037
kill -9 <pid of process of your incorrectly running adb>

And go

adb devices

回答by 1mike12

I tried every answer here and on a few of the other threads here.

我在这里和这里的其他一些线程上尝试了所有答案。

  • deleted ~/.android folder
  • killing the server (which doesn't work because it still says can't ACK)
  • greping the process
  • 删除 ~/.android 文件夹
  • 杀死服务器(这不起作用,因为它仍然说无法确认)
  • grep 过程

My adb was through brew, so I just ran brew cask reinstall android-platform-toolsand it worked again.

我的 adb 是通过 brew 完成的,所以我就跑了brew cask reinstall android-platform-tools,它又开始工作了。

回答by pvalle

The solution to my problem was to run Android Studio AS ADMINISTRATOR, it seems that when I updated Android Studio to 3.5.2 somehow the status changed, causing me the problem.

我的问题的解决方案是运行 Android Studio AS ADMINISTRATOR,似乎当我将 Android Studio 更新到 3.5.2 时,状态发生了变化,导致了我的问题。

回答by Acau? Pitta

adb kill-server

if happens an error with port:

如果发生端口错误:

adb reconnectsolve it for me

adb reconnect帮我解决