android - ADB TCP port automatically changes to 5037
问题描述
I am connecting wireless over TCP to a rooted samsung android device via ADB. By following instructions in this.
Everything seems just fine but it seems that sometimes Android Studio cannot connect by the port 5555
so it changes it to 5037
.
Which causes the connection to get refused, so when I try to connect using adb connect 192.168.2.109:5555
, I get:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
unable to connect to 192.168.2.109:5555: Connection refused
Solution of this problem: I have changed TCP port in my android device to be 5037 and it works perfectly
My Question is: why is the TCP port in Android Studio changing?
Information: OS: Ubuntu 18.04.1 LTS, Android Studio: 3.1.4
解决方案
一切似乎都很好,但似乎有时 Android Studio 无法通过端口 5555 连接,因此将其更改为 5037。
这不是这里真正发生的事情。你对流程的理解是完全错误的。
有3个部分adb
:
adbd
守护进程,它在每个设备或模拟器实例中作为后台进程运行。adb
服务器,它在您的开发机器上作为后台进程运行。服务器处理多路复用并管理adb
客户端和adb
守护程序之间的整体通信。adb
客户端(与服务器相同的二进制文件adb
),它也在您的开发机器上运行。
adb tcpip <PORT>
命令更改adbd
设备上守护程序的配置。
adb connect <IP>:<PORT>
命令告诉服务器通过 TCPIP 网络而不是默认的 USB 连接adb
连接到远程守护进程。adbd
最后* daemon not running. starting it now on port 5037 *
消息是指正在启动的本地adb
服务器实例。端口5037
用于adb
客户端和服务器之间的通信,它与或命令adb
指定的端口无关。adb tcpip
adb connect
那么你为什么Android Studio中的TCP端口会改变?问题没有答案,因为 Android Studio 没有改变任何东西。从unable to connect to 192.168.2.109:5555
您可以看到它确实正在尝试5555
按照指示使用该端口。
推荐阅读
- apache-spark - 对 Spark/Graphx/Pregel 示例程序的停止条件感到困惑,以查找“路径距离”
- nativescript - Nativescript Playground:未捕获的错误消息
- bash - 通过 SSH 访问 codeship 上的 github repo
- python - Python 请求:多部分,其中一部分为 json
- javascript - 如何在 window.alert() 中显示无序列表?
- java - jOOQ 在预期 UTC 时使用本地时区设置时间戳
- json - 如何将此 Full Swagger 2.0 模式解析为 JSON
- c - 如何使用微控制器在 C 中实现中断标志?
- awk - Unix/Perl/Python:大数据集上的替代列表
- x86 - 分支如何在来自微码定序器的代码中工作?