ADB Debugging over Bluetooth

本文介绍如何通过蓝牙连接手机与Android Wear手表进行调试。主要内容包括:启用设备上的调试选项、设置调试会话以及运行调试命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文 https://developer.android.com/training/wearables/apps/bt-debugging.html

Debugging over Bluetooth

You can debug a watch app over Bluetooth by routing the app's debug output to the phone that is connected to your development machine.

Set Up Devices for Debugging


Enable USB debugging on the phone:

  1. In Settings > About phone, tap Build number seven times to enable the Developer Options.
  2. In Settings > Developer Options, enable USB debugging.

Enable Bluetooth debugging on the watch:

  1. Open the Settings menu on the watch.
  2. Scroll to the bottom of the menu and tap About.
  3. Tap the build number 7 times.
  4. From the Settings menu, tap Developer Options.
  5. Confirm that ADB debugging is enabled.
  6. Enable Debug over Bluetooth.

Set Up a Debugging Session


  1. On the phone, open the Android Wear companion app.
  2. Tap the Settings icon.
  3. Enable Debugging over Bluetooth. A status summary, as follows, is displayed under the option:
    Host: disconnected
    Target: connected
  4. Connect the phone to your machine over USB and run:
    adb forward tcp:4444 localabstract:/adb-hub
    adb connect 127.0.0.1:4444

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

  5. When prompted on the watch, confirm that you are allowing ADB Debugging.

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

Host: connected
Target: connected

Debug Your App


Your watch is connected as 127.0.0.1:4444 when running adb devices. To run any adb command, use this format:

adb -s 127.0.0.1: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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值