Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Wear Enable ADB Connection Over WiFi TCP/IP

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?

like image 239
Luke Avatar asked Jul 24 '15 14:07

Luke


People also ask

How do I enable ADB over TCP IP?

Type adb tcpip 5555 in the command line or Terminal and press Enter. Find your phone's IP address in Settings > About Phone > Status > IP Address. Back in the command line or Terminal, type adb connect [your Android's IP address]. Finally, press Enter again.

What is ADB over Wi-Fi?

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.


1 Answers

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!

like image 200
Johnny Avatar answered Oct 10 '22 16:10

Johnny