Android Wear Enable ADB Connection Over WiFi TCP/IP

Luke picture Luke · Jul 24, 2015 · Viewed 7.5k times · Source

I'm trying to develop an app for Android Wear. In order to test my app on my Moto 360 watch (which has no USB port):

  1. I connected my phone to my computer via USB.

  2. I opened the Android Wear companion app on my phone and enabled "debugging over Bluetooth."

  3. I opened the developer options on my watch and enabled "adb debugging," and "debugging over Bluetooth."

  4. I opened a terminal on my computer and issued the commands

    (1) adb forward tcp:4444 localabstract:/adb-hub
    
    (2) adb connect localhost:4444
    
  5. I clicked the "run" button from Android Studio and selected my Moto 360 watch as the target device.

All of this worked, and I'm able to see my app in action on my watch. However, installing the app over Bluetooth using the above method takes a really really long time. Sometimes a minute, sometimes 10 minutes, it's always variable. The app I'm testing is very small: a couple xml files and 1 java class with no additional resources.

My question is: is there a way for me to install my Android Wear app directly to my Moto 360 watch via WiFi instead of Bluetooth?

In a terminal on my computer, I tried using the commands:

(1) adb tcpip 5555

(2) adb connect 192.168.1.23:5555

but I get the error

unable to connect to :5555

So then I tried using adb to open a shell on my watch, start the adb server, and then connect to it:

(1) adb -s localhost:4444 shell

(2) adb start-server:5555

(3) exit

(4) adb connect 192.168.1.23:5555

but I still get the same error

unable to connect to :5555

So again I ask, is there a way on Android Wear devices to enable ADB connections over WiFi TCP/IP so that I can install my apps via WiFi instead of Bluetooth?

Answer

Johnny picture Johnny · Aug 28, 2015

These steps I have tried. It's works.
First, you need to connect the Moto 360's adb via bluetooth.
Turn on the ADB debugging and Debug over bluetooth options on your wear and turn on the Debugging over bluetooth option on your phone.
(If you don't have Developer options menu, tap it serval times on About > Build number )

Type the command to connect adb via bluetooth:

adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444

Next, connect the Wifi network and type these commands.

adb -s localhost:4444 tcpip 5555

It will turn on the wifi adb

Last step, connect it via Wifi.

adb connect 192.168.1.3:5555

Have fun!