我正在尝试访问可穿戴数据层以与手机应用程序通信,如图所示 here .
但是,在编写以下行之后:DataClient dataClient = Wearable.getDataClient(context);
Android lint 在 Android Studio 中对其进行标记并显示以下错误:Cannot access com.google.android.gms.hasApiKey
任何人都可以帮助我了解此错误的含义以及如何解决它。
P.S.:我已经通过向我的 gradle 文件添加必要的配置来集成 Google Play Services API。
最佳答案
我也遇到了这个错误(在使用 Google Play Services API 的功能时):
error: cannot access HasApiKey
解决方案是显式添加
play-services-base
对项目的依赖:implementation 'com.google.android.gms:play-services-base:17.2.1'
关于android - 访问 android wear 数据层时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58202877/