Garreth S
Garreth S

Reputation: 83

Unable to get Wireless ADB working - removing USB cable will disconnect the TCPIP device

Device: HTC One

Requirements: get Wireless ADB working so i can play around with USB OTG, with peripheral connected.

Network topology: Mobile device has wireless hotspot enabled, development machine is connected to this hotspot.

Notes: Device is rooted, Wifi ADB is installed

when i run Wifi ADB it gives me two IP addresses 192.168.1.1/24 10.114.254.41/30 Port:8000

With all the guides i've followed, i've managed to connect to 192.168.1.1 i've ran adb -s 192.168.1.1 logcat and that spews out a lot of data; a good sign.

the command 'adb devices' shows the usb device and the IP device however, if i unplug the usb cable i lose connection... running the command 'adb devices' now shows no devices..

Any ideas? too frustrated to think straight atm, its ridiculous how complicated this is, i just want to write some frigging code -_-

Upvotes: 3

Views: 3117

Answers (5)

stare.in.the.air
stare.in.the.air

Reputation: 271

I can't get it to stay connected. That's why I wrote this adb auto reconnect shell script:

#!/bin/bash

if [ $# -ne 1 ]; then
    echo "i need one parameter: the address (with port) of your android phone"
    exit 1
fi

while true; do
    if [ $(adb devices | grep "$1" | wc -l) -lt 1 ]; then
        adb connect $1
        adbExitCode=$?
        if [ $adbExitCode -ne 0 ]; then
            echo "adb connect failed"
        fi
    fi
    sleep 1
done

Source: https://github.com/StareInTheAir/shell-scripts/blob/master/adb-auto-reconnect

Not elegant, but it works.

Upvotes: 0

Ayaz Alifov
Ayaz Alifov

Reputation: 8608

If your device is rooted then it is very simple to make a wireless connection. I used this app from Google Play (https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb&hl=en) and it worked perfect, just try.

Upvotes: 0

AndroidNewbie
AndroidNewbie

Reputation: 515

Rebooting definitely did not fix it here. I can establish a WiFi TCP/IP connection to ADB, it works great and debugging proceeds normally. But if I'm debugging a USB peripheral, and I disconnect the USB cable, I lose the ADB connection. I have to "adb connect", then go into DDMS and manually reassociate with the still-running app. Extremely annoying!

Upvotes: 0

Garreth S
Garreth S

Reputation: 83

rebooting the phone seems to have fixed it :/

Upvotes: 0

Ivan
Ivan

Reputation: 6013

The following works fine for me:

  1. Connect the device via the cable
  2. Run adb tcpip <port> where <port> is the port on which your device will listen
  3. Disconnect the cable and connect your peripheral
  4. Run adb connect <device ip>:<port>

After this you should be able to debug your apps as over a wired connection.

Upvotes: 9

Related Questions