page.title=Debugging over Bluetooth page.tags=wear helpoutsWidget=true @jd:body

This lesson teaches you to

  1. Set Up Devices for Debugging
  2. Set Up a Debugging Session
  3. Debug Your App

You should also read

You can debug your wearable over Bluetooth by routing its debug output to the handheld device that's connected to your development machine.

Setup Devices for Debugging

  1. Enable USB debugging on the handheld:
  2. Enable Bluetooth debugging on the wearable:
    1. Tap the home screen twice to bring up the Wear menu.
    2. Scroll to the bottom and tap Settings.
    3. Scroll to the bottom. If there's no Developer Options item, tap About, and then tap the build number 7 times.
    4. Tap the Developer Options item.
    5. Enable Debug over Bluetooth.

Set Up a Debugging Session

  1. On the handheld, open the Android Wear companion app.
  2. Tap the menu on the top right and select Settings.
  3. Enable Debugging over Bluetooth. You should see a tiny status summary appear under the option:
    Host: disconnected
    Target: connected
    
  4. Connect the handheld to your machine over USB and run:
    adb forward tcp:4444 localabstract:/adb-hub
    adb connect localhost:4444
    

    Note: You can use any available port that you have access to.

In the Android Wear companion app, you should see the status change to:

Host: connected
Target: connected

Debug Your App

Your wearable should show up as localhost:4444 when running adb devices. To run any adb command, use this format:
adb -s localhost:4444 <command> 

If there are no other devices connected over TCP/IP (namely emulators), you can shorten the command to:

adb -e <command>

For example:

adb -e logcat
adb -e shell
adb -e bugreport