LocationRequest and LocationServices.API are not resolved
13,145
Solution 1
Seems like you need to compile the play-services-location
package.
Put these into the build.gradle
ext {
playServicesVersion = '10.2.0' // update accordingly
}
dependencies {
...
compile "com.google.android.gms:play-services-maps:${playServicesVersion}"
compile "com.google.android.gms:play-services-location:${playServicesVersion}"
}
Solution 2
Try this
implementation 'com.google.android.gms:play-services-location:15.0.1'
in your app.gradle, and update the version regularly.
Author by
Krishna Avadhanam
Updated on June 28, 2022Comments
-
Krishna Avadhanam almost 2 years
I have a high priority project under development.
I am trying to insert geo location into db so I found a service online and unfortunatelyLocationRequest
andLocationServices.API
are not resolved.
I am using the dependency'com.google.android.gms:play-services-maps:10.2.0'
I tried adding the imports
import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices;
You can find the code I used at this link