Android Wear CapabilityApi cannot find handheld capabilities

两盒软妹~` 提交于 2019-12-21 17:39:10

问题


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.

  • 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.


回答1:


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

debug { signingConfig null }

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



来源:https://stackoverflow.com/questions/30653984/android-wear-capabilityapi-cannot-find-handheld-capabilities

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!