This lesson teaches you to
You should also read
You can debug your wearable over Bluetooth by routing it's debug output to the handheld device that's connected to your development machine.
Setup Devices for Debugging
- Enable USB debugging on the handheld:
- Open the Settings app and scroll to the bottom.
- If it doesn't have a Developer Options setting, tap About Phone (or About Tablet), scroll to the bottom, and tap the build number 7 times.
- Go back and tap Developer Options.
- Enable USB debugging.
- Enable Bluetooth debugging on the wearable:
- Tap the home screen twice to bring up the Wear menu.
- Scroll to the bottom and tap Settings.
- Scroll to the bottom. If there's no Developer Options item, tap About, and then tap the build number 7 times.
- Tap the Developer Options item.
- Enable Debug over Bluetooth.
Set Up a Debugging Session
- On the handheld, open the Android Wear companion app.
- Tap the menu on the top right and select Settings.
- Enable Debugging over Bluetooth. You should see a tiny status summary appear under the
option:
Host: disconnected Target: connected
- 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 aslocalhost: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