[英]adb connection by wifi getting killed when a new USB attached/detached
I develop on my tablet using android studio
.我使用
android studio
在我的平板电脑上开发。 The tablet is connected to the computer by wifi using平板电脑使用 wifi 连接到计算机
adb connect <ip_andress>:5555
My application contains listeners for USB devices attached/detached
.我的应用程序包含
attached/detached
的 USB 设备的侦听器。 But unfourtunately, when I connect/disconnect usb device to/from the tablet, the adb connection is getting killed
, and I can no longer see the device under "adb devices".但不幸的是,当我将 USB 设备与平板电脑连接/断开连接时,adb 连接
killed
终止,并且我无法再在“adb devices”下看到该设备。
It is not a adb-connection-by-wifi what gets killed.被杀死的不是adb-connection-by-wifi 。 It is just that USB enumerations affect the
sys.usb.*
system properties which on many devices is causing restart of adbd
regardless whether it's being used over USB
or tcpip
.只是 USB 枚举会影响
sys.usb.*
系统属性,这在许多设备上会导致adbd
重新启动,无论它是通过USB
还是tcpip
使用。
Do grep "stop adbd" /init*rc
to see what I mean.执行
grep "stop adbd" /init*rc
看看我的意思。
You could either comment out those stop adbd
lines or just disconnect the USB cable before running your adb connect
command.您可以注释掉那些
stop adbd
行,或者在运行adb connect
命令之前断开 USB 电缆。
I was never able to connect my cellphone with my computar through wi-fi.我永远无法通过无线网络连接我的手机和我的电脑。
I had already given up.我已经放弃了。 I followed all the instructions and tips, and nothing worked.
我遵循了所有的说明和提示,但没有任何效果。
Finally, I did what no one said to do.最后,我做了没有人说要做的事。
I've connected the phone to the WiFi network provided by the cable modem itself and not to some (not all) additional networks that are included in the router.我已将手机连接到电缆调制解调器本身提供的 WiFi 网络,而不是连接到路由器中包含的某些(不是全部)其他网络。
At home I use one of these networks, because I use a Deco Tp-Link router
, which propagates the signal to my entire house, but this network is NOT compatible with ADB .在家里,我使用其中一个网络,因为我使用
Deco Tp-Link router
,它将信号传播到我的整个房子,但这个网络与ADB不兼容。 It does not identify it as belonging to the same network.它不会将其识别为属于同一网络。
After this, I use the normal procedure described here .在此之后,我使用此处描述的正常程序。
a) Connect cellphone with a USB cable a)用USB 数据线连接手机
b) Find the IP_Phone
depends on system in the cell phone. b)查找
IP_Phone
取决于手机中的系统。 Here I use Settings
, About Phone
, Status
and IP address
.这里我使用
Settings
、 About Phone
、 Status
和IP address
。
c) Run the following adb commands in Command Prompt
(Windows) or Terminal
(Linux), where IP_Phone
is the IP above mentioned. c)在
Command Prompt
(Windows) 或Terminal
(Linux) 中运行以下 adb 命令,其中IP_Phone
是上述 IP。 Normally adb.exe
is an executable stored in computer path.通常
adb.exe
是存储在计算机路径中的可执行文件。 adb
is already included in Android Studio package. adb
已经 包含在Android Studio包中。
adb tcpip 5555
adb connect IP_Phone
d) Now disconnect USB cable and it's ready. d)现在断开USB电缆并准备就绪。 The cellphone model continues to appear in the status line in the top of Android Studio .
手机型号继续出现在Android Studio顶部的状态栏中。
-/- -/-
The best wifi is that defined in Cable Modem.最好的 wifi 是在 Cable Modem 中定义的。 It, unlike an any account defined in my router, answers to a ping command.
与我的路由器中定义的任何帐户不同,它会回答 ping 命令。
ping IP_Phone
在运行adb connect <*ip_address_of_your_phone*>
之前断开 USB 电缆
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.