willy
willy

Reputation: 101

Which library should I use for Location when using google maps?

I have the following library for the google maps and it works fine

implementation 'com.google.android.gms:play-services-maps:16.1.0'

But when I try to add this one for location,

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

the following error occurs

Failed to resolve: com.google.android.gms:play-services-location:16.1.0

Which library for the location should I use? THANK YOU.

Upvotes: 0

Views: 131

Answers (2)

WarrenFaith
WarrenFaith

Reputation: 57672

It is probably because 16.1.0 does not exist for this library. Google Play Services libraries do not always have the same version. So maps might be on 16.1.0 but location might not even have this version.

To get the latest versions, check the official release page: https://developers.google.com/android/guides/releases

And as you are just starting, make sure to use the latest ones:

com.google.android.gms:play-services-location:17.0.0
com.google.android.gms:play-services-maps:17.0.0

Yes, it is a coincident that those versions are currently the same. As you can see in the list there are already libraries on 19.0.0, like appindexing

com.google.firebase:firebase-appindexing:19.0.0

Edit

A small practical tip: If you replace the version by + and sync the project, gradle will get the newest one and afterwards you can use the IDE warning to replace the + again with the newest version number. That eases a bit the checking on different pages if there is a new version or not etc

Upvotes: 1

TechHelper
TechHelper

Reputation: 821

You will get latest gradle dependencies here

https://developers.google.com/android/guides/setup

Upvotes: 1

Related Questions