android - 如何运行 Android Sample Watch Face?

标签 android wear-os watch-face-api

这是我做的

  1. 文件->导入样本
  2. 创建了 2 个模块。应用与可穿戴
  3. 执行哪一个?无论如何我都试过了
  4. 我没有遇到任何错误
  5. 我在运行时注意到左下角有“Session 'Application' Running”/“Session 'Wearable' Running” enter image description here
  6. 但我仍然无法在手机和智能 watch 上的任何地方看到它

我读了这个Setup Android Wear Device

  1. Install the Android Wear app, available on Google Play, on your handheld.
  2. Follow the app's instructions to pair your handheld with your wearable. This allows you to test out synced handheld notifications, if you're building them.
  3. Leave the Android Wear app open on your phone.
  4. Connect the wearable to your machine through USB, so you can install apps directly to it as you develop. A message appears on both the wearable and the Android Wear app prompting you to allow debugging. Note: If you can not connect your wearable to your machine via USB, follow the directions on Debugging over Bluetooth.
  5. On the Android Wear app, check Always allow from this computer and tap OK. The Android tool window on Android Studio shows the system log from the wearable. The wearable should also be listed when you run the adb devices command.

关于上面的第 4 点。如何真正通过 USB 将我的智能 watch 连接到我的笔记本电脑?!?!?

我有 Nexus 5 和 Moto 360 以及最新的 Android Studio。

最佳答案

我会仔细检查可穿戴设备和 Android Wear 应用是否启用了调试。否则,如果您有 Moto 360,则在 watch 上调试应用程序的唯一方法是通过蓝牙。

重要的是要注意,当您的应用未签署生产许可时,您必须将应用直接安装到可穿戴设备上。

如果您需要通过蓝牙连接,请执行以下操作:

要启用磨损调试,请执行以下操作:

  1. 在手持设备上,打开 Android Wear 配套应用。

  2. 点击右上角的菜单并选择“设置”。

  3. 启用蓝牙调试。您应该会在选项下方看到一个微小的状态摘要:

    Host: disconnected

    Target: connected

  4. 通过 USB 将手持设备连接到您的机器并运行:

    adb forward tcp:4444 localabstract:/adb-hub

    adb connect localhost:4444

注意:您可以使用您有权访问的任何可用端口。

注意:如果您无法连接到本地主机:4444:连接被拒绝。尝试运行:

adb connect 127.0.0.1:4444

在此之后,如果您运行 adb devices,您应该会在列表中看到您的可穿戴设备。

关于android - 如何运行 Android Sample Watch Face?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28260905/

相关文章:

Android RecyclerView Checkbox 随机勾选

android - 多声道音频和录音709 高清标准

java - Android - 在 ExpandableListView 中查看每个组的特定子项

android - 使用 DataMap 发送和接收数据 - Android 可穿戴设备

Android Wear 表盘在屏幕关闭时振动

AsyncTask 类中的 Android Intent 给出错误

Android Wear 应用程序未通过手机安装

android - 华为 Watch 2 NFC 功能不可用?安卓穿戴 2.0

java - 重启安卓服务

android - 如何在 wearOS android 中默认添加并发症