3

My app uses the FusedLocationProviderApi for getting the current location. I've already put the line which allows the app to use Google Play Services in the gradle file for my app module:

compile 'com.google.android.gms:play-services-ads:11.0.2'

But when I try to declare a FusedLocationProvider variable, it turns red and does not recognize the class. My only guess is that I should probably import the class, but I don't know exactly how.

TofferJ
  • 4,678
  • 1
  • 37
  • 49

1 Answers1

10

You are currently only importing the ads API.

In addition to the ads compile line, you will need to add this to your build.gradle:

implementation 'com.google.android.gms:play-services-location:16.0.0'

To see the current breakdown of individual APIs, take a look at the documentation: https://developers.google.com/android/guides/setup

Kundan
  • 590
  • 9
  • 21
Daniel Nugent
  • 43,104
  • 15
  • 109
  • 137
  • Thank you very much Daniel - it worked :) I am very new to android studio- will remember for next time. –  Jul 05 '17 at 19:27