Reputation: 31
I am trying to build an android app using android studio that uses the direct user location, and I am got error on import com.google.android.gms.location.LocationListener; it says it can't resolve symbol 'LocationListener', and also for 'LocationRequest' and 'LocationServices' I tried searching for an answer but I can't figure out what the problem is.
Upvotes: 1
Views: 11639
Reputation: 17017
Things has changed since 2018, and Gradle 3.0.0. Now you must use:
implementation
instead of compile
, in your ./app/build.gradle
, in the dependencies{}
section. Like this:
dependencies {
...
implementation 'com.google.android.gms:play-services-location:16.0.0'
...
}
Search for location
in the releases web page.
Upvotes: 7
Reputation: 1420
Check out this link for the list of Google Play libraries and you can add the location library.
https://developers.google.com/android/guides/setup
implementation 'com.google.android.gms:play-services-location:11.6.0'
This should resolve.
Upvotes: 2
Reputation: 266
Try adding the below :
compile 'com.google.android.gms:play-services:9.8.0'
in your app level gradle dependencies and
classpath 'com.google.gms:google-services:3.1.0'
in project level gradle dependencies
note the versions may change based on your SDK config or your preference
Upvotes: 7