17

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?

2
  • when you run on the smartwatch via bluetooth keep away all cordless devices, radio and phones. They could create interference. Commented Jul 24, 2015 at 14:34
  • Not exactly an answer to your problem, but if your only qualm is the install time for your APK, you could try using the Wear emulator for line-by-line testing. When you finish a bug fix or feature, you can then install to your actual Wear device and test it there. Again, this doesn't exactly answer your question, but it could streamline your development process.
    – Sean Beach
    Commented Jul 24, 2015 at 15:24

5 Answers 5

7

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!

6
  • 1
    The only problem with this is that Android Wear shuts off the wifi if it has a bluetooth connection with the phone. Your steps worked fine for me only if I shut off my phones bluetooth after adb -s localhost:4444 tcpip 5555. The only wifi settings for wear are Off or Automatic unless you know of a way to keep wifi alive on the watch?
    – cgv
    Commented Sep 17, 2015 at 7:21
  • Hi cgv, I think you have to check the wifi connection before enter the command after adb -s localhost:4444 tcpip 5555
    – Johnny
    Commented Sep 23, 2015 at 2:20
  • I'm not really sure as i have not found any info about it. But there's an option under "developer options" that says "Allow auto wifi state change", my guess is that this options prevents the wifi turning off. Commented Apr 28, 2016 at 3:12
  • Another tip: sometimes localhost wont work, try replacing it with 127.0.0.1 Commented Apr 28, 2016 at 3:13
  • For me 127.0.0.1 does not work. Got to give localhost a try. What exactly is the difference between 127.0.0.1 and localhost? Commented Aug 7, 2017 at 21:46
2
adb forward tcp:4444 localabstract:/adb-hub

adb connect 127.0.0.1:4444
1

Using @Johnny along with other answers and @cgv comment, heres my "full" guide:

On wear:

Go to config -> about -> tap the version umber 7 times (it will enable dev options) Now go back to config menu Go to developer options Enable adb (it will also enable the option adb over bluetooth)

On phone:

Open android wear app Tap the cog icon Enable Debug over wifi -> Check that the host will be connected (its the android wear)

Now open cmd (you will need to have adb on your path variable):

adb forward tcp:4444 localabstract:/adb-hub adb connect localhost:4444 // if this gives an error try replacing localhost with 127.0.0.1 adb -s localhost:4444 tcpip 5555 // if this gives an error try replacing localhost with 127.0.0.1

On phone:

Disable adb over bluetooth Disable bluetooth

On wear:

Go to config -> developer options -> disable the option auto change wifi state Go to wifi, connect to your wifi still on wifi, theres an advanced options, there you can get your ip address

on cmd:

adb connect 192.168.1.3:5555 // replace 192.168.1.3 with your android wear ip

I have created an xda forum thread if anyone wants to make a script or contribute.

1

Just a quick note that they removed the Debug over Bluetooth option from Wear OS some time in 2021. Downgrading to an older version from APK Mirror should give you back that feature.

0

Yes there is you can make a usb cable theres a turorial for it on youtube underneath the band there is a 5 pin connecter so you would also need to remove the band

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.