【问题标题】:Error while accessing android wear data layer访问 android wear 数据层时出错
【发布时间】:2020-01-31 19:31:21
【问题描述】:

我正在尝试访问可穿戴数据层以与手机应用程序进行通信,如图所示here

但是,在写完下面这行之后:

DataClient dataClient = Wearable.getDataClient(context);

Android lint 在 Android Studio 中对其进行标记并显示以下错误:

Cannot access com.google.android.gms.hasApiKey

谁能帮我理解这个错误的含义以及我该如何解决它。

P.S.:我已经通过向我的 gradle 文件添加必要的配置来集成 Google Play Services API。

【问题讨论】:

    标签: android wear-os android-wear-data-api android-wear-2.0


    【解决方案1】:

    我也遇到了这个错误(在使用 Google Play Services API 的功能时):

    error: cannot access HasApiKey
    

    解决方案是在项目中显式添加play-services-base 依赖项:

    implementation 'com.google.android.gms:play-services-base:17.2.1'
    

    【讨论】:

      猜你喜欢
      • 2019-12-10
      • 2017-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-20
      相关资源
      最近更新 更多