Android Wear CapabilityApi无法找到掌上电脑功能 [英] Android Wear CapabilityApi cannot find handheld capabilities

查看:57
本文介绍了Android Wear CapabilityApi无法找到掌上电脑功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用MessageAPI在手持式应用程序与可穿戴式应用程序之间来回通信.我无法进行通讯.我可以确认设备已连接,但是当我的代码执行时,就好像两个应用程序都没有注册我所请求的功能一样.

I'm attempting to use MessageAPI to communicate back and forth between my handheld app and wearable app. I can't get the communication to work. I can confirm the devices are connected, but when my code executes, it acts like neither app has registered the Capability I am requesting.

  • 通知已成功从手持设备发送到穿戴设备
  • Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await()返回一个列表,显示手持式设备或可穿戴设备确实已连接
  • Wearable.CapabilityApi.getAllCapabilities(mGoogleApiClient,CapabilityApi.FILTER_ALL).await()返回一个空列表:-(
  • 已为两个应用程序都设置了
  • values/wear.xml
  • 两个应用在gradle中都设置了相同的applicationID
  • 都成功连接到GoogleApiClient
  • 都向Wearable.MessageApi.addListener()注册监听器
  • notifications are successfully sent from handheld to the wear device
  • Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await() returns a list showing the handheld or wearable is indeed connected
  • Wearable.CapabilityApi.getAllCapabilities(mGoogleApiClient, CapabilityApi.FILTER_ALL).await() returns an empty list :-(
  • values/wear.xml has been set for both apps
  • both apps have the same applicationID set in gradle
  • both successfully connect to the GoogleApiClient
  • both register a listener with Wearable.MessageApi.addListener()

还有哪些其他可能的故障要检查?我的示例应用程序运行良好,并且已成功将其集成到现有的简单项目中,但是当我将相同的代码添加到我的主要项目中时,它将无法正常工作.我已经进行了梳理,但是找不到任何可能干扰我正在做的事情的代码.

What other possible points of failure are there that I should check? My sample apps work great, and I integrated it into an existing simple project successfully, but when I add the same code to my major project, it doesn't work. I've combed through but can't find any code that could interfere with what I'm doing.

推荐答案

原来是build.gradle文件中的一行引起了麻烦.

Turned out that a line from the build.gradle file was causing the trouble.

debug { signingConfig null }

修复此问题后,恢复了Wear和Handheld应用之间的连接.

Removing this line fixed restored the connection between the Wear and the Handheld apps.

这篇关于Android Wear CapabilityApi无法找到掌上电脑功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆