You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调试Wear OS Kotlin表盘示例遇超时错误,模拟器等待调试器连接求助

解决Android Studio调试WatchFaceKotlin示例的超时与调试器连接问题

问题详情

使用Android Studio 2021.1.1 Patch 1调试WatchFaceKotlin Wear OS表盘示例,在Android T版本模拟器上可正常运行表盘,但调试时触发超时错误:

[AndroidXMetadataFetcher]Timed out creating WatchFaceMetadataClient for WatchFaceId[xxx.watchface,xxx.watchface.AnalogWatchFaceService]
java.util.concurrent.TimeoutException: Waited 5000000000 nanoseconds (plus 394200 nanoseconds delay) for androidx.concurrent.futures.ResolvableFuture@164804c[status=PENDING]

同时模拟器界面显示“正在等待调试器连接”的提示。

可行解决方案

  • 延长调试超时阈值
    打开Android Studio的File > Settings > Build, Execution, Deployment > Debugger,找到Debugger timeout项,将默认的5000毫秒调整为10000毫秒以上,保存设置后重新启动调试。

  • 彻底重启并清理缓存

    1. 通过AVD Manager彻底停止模拟器进程,不要仅关闭窗口
    2. 关闭Android Studio,执行File > Invalidate Caches...,勾选Clear file system cache and local history后重启AS
    3. 重新启动模拟器,加载项目后再次尝试调试
  • 手动绑定调试器到表盘服务进程
    表盘运行在独立的WatchFaceService进程中,默认调试可能未正确关联:

    1. 启动表盘后,点击AS工具栏的Attach Debugger to Android Process按钮(绿色调试图标旁的下拉箭头)
    2. 在进程列表中找到对应包名的xxx.watchface进程,选中后点击OK完成绑定
  • 更新开发环境组件

    • 将Android Studio升级至最新稳定版本
    • 打开SDK Manager,更新Wear OS SDK Platform、Android Emulator及对应T版本的系统镜像,确保组件版本兼容
  • 优化模拟器配置
    编辑目标模拟器的配置:

    • 提升RAM至1024MB以上,VM Heap设置为256MB
    • 选择Cold boot now启动方式,避免快速启动导致的进程异常

内容的提问来源于stack exchange,提问作者iMan Biglari

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 17:19:50