adb connection by wifi getting killed when a new USB attached/detached
Asked Answered
T

3

2

I develop on my tablet using android studio. The tablet is connected to the computer by wifi using

adb connect <ip_andress>:5555

My application contains listeners for USB devices attached/detached. 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".

Togo answered 18/10, 2016 at 10:24 Comment(1)
Did you manage to solve that?Turgeon
S
0

It is not a adb-connection-by-wifi what gets killed. 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.

Do grep "stop adbd" /init*rc to see what I mean.

You could either comment out those stop adbd lines or just disconnect the USB cable before running your adb connect command.

Siphon answered 18/10, 2016 at 21:18 Comment(1)
Editing init*rc files is not possible for me, as my device isn't rooted. Also, running "adb connect" after disconnecting the USB caused "unable to connect. Connection refused".Meissner
C
0

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.

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. 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

b) Find the IP_Phone depends on system in the cell phone. Here I use Settings, About Phone, Status and IP address.

c) Run the following adb commands in Command Prompt (Windows) or Terminal (Linux), where IP_Phone is the IP above mentioned. Normally adb.exe is an executable stored in computer path. adb is already included in Android Studio package.

adb tcpip 5555
adb connect IP_Phone 

d) Now disconnect USB cable and it's ready. The cellphone model continues to appear in the status line in the top of Android Studio.

-/-

The best wifi is that defined in Cable Modem. It, unlike an any account defined in my router, answers to a ping command.

ping IP_Phone
Cheslie answered 8/10, 2020 at 20:12 Comment(1)
I know, but the official instruction of Android Studio documantation is turn off USB after adb connect commandCheslie
G
0

Disconnect the usb cable just before running adb connect <*ip_address_of_your_phone*>

Gounod answered 5/6, 2022 at 16:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.