<等待翻译>Android Wear 进阶 2.6 Debugging over Bluetooth 通过蓝牙调试

Debugging over Bluetooth

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:
    • 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.
  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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值