Debugging over Bluetooth
Bluetooth debugging only works for Android-paired watches. Before you begin, be sure the watch
and phone are paired and you've enabled
developer options on the watch. You should also be sure
that developer options is also enabled on the phone. To check, open the phone's
Settings menu, select
About phone and click the build number seven times.
Enable USB debugging on the phone
- Open the phone's Settings menu.
- Select Developer Options and enable USB debugging.
Enable ADB/Bluetooth debugging on the watch
- Open the watch's Settings menu.
- Scroll to Developer Options.
- Confirm that ADB debugging is enabled.
- Enable Debug over Bluetooth.
Enable Bluetooth debugging on the phone
-
On the phone, open the Android
Wear companion app.
-
Tap the Settings → Debugging
over Bluetooth. Next click on the “Device to Debug” and
select your devices.
-
Then a status message appears
under the option. It looks like this:
Host: disconnected
Target: connected
At this point the development machine (the host) is not communicating with
with the watch (the target). You need to complete the link.
Connect the debugger to the watch
In this final step, you'll use everything: the debugger, the phone, and the watch.
- Connect the phone to your development machine with a USB cable.
- Run these two commands in the debugger:
adb forward tcp:4444 localabstract:/adb-hub
adb connect 127.0.0.1:4444
Note: You must use the IP address 127.0.0.1. You can use any available port on
your development machine. Be sure you use the same port in both commands. (In this example the port
is 4444.)
- After you type the connect command, look at the watch. It will ask you to confirm that you are
allowing ADB Debugging.
- Go back to the phone and check the status display in the Android Wear companion app. It should look like this:
Host: connected
Target: connected

The watch is now connected to the debugger and you're ready to start debugging.
When you debug a watch using Bluetooth, adb always
uses the IP address
127.0.0.1 plus the port that you assigned. Therefore, all adb commands use this format
(continuing the example, the port is 4444):
adb -s 127.0.0.1:4444 <command>
If you are not using the emulator and have only one device connected for debugging, you don't
need to specify the address at all:
adb <command>
Once after above setup is done then it should show two(phone and watch) devices as below :
~$ adb devices
List of devices attached
9887b7394b30585930 device
127.0.0.1:4444 device
To connect exactly android wear device :
~$ adb connect 127.0.0.1:4444
connected to 127.0.0.1:4444
In Linux terminal use following commands to get wearable logs:
$ adb -s 127.0.0.1:4444 logcat *:i|grep -i "your project package name"
~$ adb -s 127.0.0.1:4444 logcat
| Global Options |
Description |
-a |
Listen on all network interfaces instead of only on
localhost. |
-d |
Direct an adb command to the only attached USB device.
Returns an error when more than one USB device is attached. |
-e |
Direct an adb command to the only running emulator.
Returns an error when more than one emulator is running. |
-s serial_number |
Direct an adb command to a specific device, referred to by its adb-assigned
serial number (such as emulator-5556). Overrides the serial number value stored in the
$ANDROID_SERIAL environment variable. See Send
Commands to a Specific Device.
|
-H server |
The name of the adb server host.
The default value is localhost. |
-P port |
The adb server port number.
The default value is 5037. |
-L socket |
Listen on the provided adb server socket.
The default value is tcp:localhost:5037. |