19

So with my nexus 5 im easily able to do something like this to connect adb over wifi:

adb tcpip 5555
adb connect 192.xxx.x.xx

and then disconnect the usb cable. I have another device im trying to connect (Dell venue 8 tablet) but it seems to disconnect from the adb wifi connection a split second after the usb is pulled.

I use the same commands:

adb tcpip 5555 (<- without another device connected)
adb connect 192.xxx.x.xx (tablet ip here)

Executing adb devices after this shows both the wifi adb connection as well as the usb connection, but with the tablet, as soon as I kill the usb connection, the wifi adb connection also terminates.

Does anyone have any thoughts on why this may be happening?

Orbit
  • 2,985
  • 9
  • 49
  • 106
  • 2
    use wifi adb app download it from playstore. and there is no need for usb connection you can directly connect using ip address just connect device and pc to same wifi – Hemant Shori Aug 04 '15 at 19:15
  • 2
    @HemantShori the device needs to be rooted for that to work. – adelphus Aug 04 '15 at 19:33
  • 1
    @HemantShori im pretty sure the device has to be switched to tcpip mode before making an ip connection..thats why it needs to connect through adb over usb first. – Orbit Aug 04 '15 at 20:00
  • 1
    yes . be a super user root it. Or try killing sever use 'adb kill-server' – Hemant Shori Aug 05 '15 at 13:49
  • 1
    Is your device rooted? Are you comfortable with rooting it? Cause that makes things a lot easier... – mlz7 Aug 12 '15 at 17:28

7 Answers7

4

For some reason, connecting the device in Charge only mode solved the problem. Just make sure "Allow ADB debugging in charge only mode" is enabled before connecting the device.

https://stackoverflow.com/a/51904546/4470297

1

Try to connect to it without the usb cable.

  • Step 1. Use wifi adb on your phone to get the ip (needs rooted phone, but because your on stackoverflow I guess you have one).
  • step 2. Type in your console adb connect (ip shown in wifi adb)

If this dosnt work please post the exact message you get in your console when trying to connect.

Non-Rooted Solution:

  • Enable USB-debugging in the developer setting and connect your phone to your computer via USB.
  • Run the adb command, adb tcpip 5555 (Make sure port 5555 is not blocked by any firewall programs)
  • Get your Wi-Fi IP address assigned to your device and run the adb command

    adb connect <IP_ADDRESS>.For example, adb connect 192.168.1.133

  • Now you can disconnect the usb cable and run adb shell, adb install, or adb push commands via your Wi-Fi.

  • Inorder to switch back to USB mode and disable the Wireless mode, run the following adb command.

    adb usb

  • You can also simply reboot your phone to switch back to the USB mode.

Community
  • 1
  • 1
Sven van den Boogaart
  • 11,833
  • 21
  • 86
  • 169
  • This does not address the problem. We know how to setup adb over Wi-Fi, it even works for us on most computers. But for some reason, on newer builds of Windows 10, when you unplug the USB cable it kills the Wi-Fi connection as well. – BrainSlugs83 Nov 16 '19 at 00:42
  • @BrainSlugs83 This question is almost 5 years old, at the time the solution was correct, no reason to downvote because 5 years later the answer does not work for you.. – Sven van den Boogaart Nov 20 '19 at 15:39
  • @BrainSlugs83 Do you have a solution as of 2021 ?. I am still having this problem on windows 10 ni 2021. It works fine on my macos. More importantly the problem is itermittent, it sometime works sometimes gets disconnected without any change from my side. – ishandutta2007 Jun 16 '21 at 03:39
0

Prerequisites

Android device and computer should be connected in same network. (If you don't have any network than you can create your own by enabling Wifi hotspot available in your device)

Step 1:

Connect Android device with USB cable to computer

Step 2: Use following command in terminal to make sure adb is running in USB mode.

$adb usb

restarting in USB mode Connect to the device over USB.

Step 3:

Execute following command in terminal to make sure adb identify/list gets connected with the device.

$adb devices

Step 4: Change adb mode from USB to tcpip using following command.

$adb tcpip 5555

restarting in TCP mode port: 5555

Step 5: Now, adb is running over TCP/IP mode, Let’s find IP address of Android device.

Go to Settings in Android device -> About -> Status -> IP address. note down the IP address of connected Android Device.

Step 6: Use following command to connect ADB with IP address

$adb connect #.#.#.#

connected to #.#.#.#:5555

Step 7: Now adb is working over Wi-fi, You can remove USB cable from Android device.

Step 8: To confirm adb is working over Wi-fi and your device is still connect. you can use following command

$adb devices

#.#.#.#:5555 device

You’re now ready to go!, Enjoy ADB over Wi-fi.

Use following command to change ADB mode to USB

$adb usb

0

For me, it looks like this was a bug with ADB server version (39). I updated to (41) and the issue went away.

It's super weird, because I was using version 39 on two different PCs and on one adb/wi-fi worked, and on the other, as soon as I unplugged the USB cable the Wi-Fi device would become disconnected as well. ‍♂️

BrainSlugs83
  • 6,214
  • 7
  • 50
  • 56
0

This is expected behavior according to Google's response at ABD debugging over wifi drops, when third-party USB device is plugged in the phone https://issuetracker.google.com/issues/112410852:

Status: Won't Fix (Intended Behavior)
usb state changes cause the system to restart adbd.

So you can re-attach your debug using the flutter attach command.

Here is a example for vscode (.vscode/launch.json):

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Flutter",
            "request": "launch",
            "type": "dart",
            "program": "${workspaceFolder}/lib/main.dart",
        },
        {
            "name": "Flutter Re-Attach",
            "request": "attach",
            "type": "dart",
            "program": "${workspaceFolder}/lib/main.dart",
        },
Luciano Ribas
  • 309
  • 2
  • 4
-2

I would suggest to:

  1. Make sure both of your devices are on the same network.
  2. While running adb connect give the port number too
  3. Make sure the default port 5555 is not used by any other service
  4. When you changed the device did you double check on the ip (In wifi connection IP keeps changing)
Sudip Bhandari
  • 2,165
  • 1
  • 27
  • 26
-3

My research results that it is some bug or unexpected behavior in Android Studio 2.3.1, which kills running adb server (with all open connections) in some situations. In example when you disconnect USB cable or close Android Studio application.

Steps to reproduce:

  1. Create TCP connection to android device by console window (i.e. adb connect 192.168.0.96)
  2. Check device is connected (adb devices)
  3. Run Android Studio and load any project
  4. Open Select Deployment Target window
  5. Close this window and Android Studio
  6. Check that adb server was killed (adb devices).
Tsad
  • 1
  • 1