4

I am trying to access the wearable data layer to communicate with the phone app as shown here.

However, after writing the following line:

DataClient dataClient = Wearable.getDataClient(context);

The Android lint flags it in Android Studio and shows the following error:

Cannot access com.google.android.gms.hasApiKey

Can anyone help me with the meaning of this error and how I can go about resolving it.

P.S.: I have already integrated the Google Play Services API by adding the necessary configuration to my gradle files.

speedster01
  • 433
  • 3
  • 19

1 Answers1

6

I encountered that error too (while using a feature of the Google Play Services API):

error: cannot access HasApiKey

The solution was to explicitly add the play-services-base dependency to the project:

implementation 'com.google.android.gms:play-services-base:17.2.1'
Floern
  • 33,559
  • 24
  • 104
  • 119