Cannot resolve symbol 'LocationRequest' Android project

BitRulez picture BitRulez · Nov 9, 2016 · Viewed 11.6k times · Source

I'm new on Android programming, I try to use the new Location Service for getting the user position, to do this i follow the official android developer guide but I don't understand why I'm not able to import LocationRequest in my fragment class.

import com.google.android.gms.location.LocationRequest; 

here is my Gradle app file:

build.gradle

 ..
   compile 'com.android.support:appcompat-v7:24.2.1'
   compile 'com.android.support:design:24.2.1'
   compile 'com.android.support:palette-v7:24.2.1'
   compile 'com.android.support:cardview-v7:24.2.1'
   compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
   compile 'com.google.code.gson:gson:2.6.2'
   compile 'com.android.volley:volley:1.0.0'
   compile 'com.android.support:support-v4:24.2.1'
   compile 'com.google.android.gms:play-services-maps:9.8.0'
 }

and this is what I include in my Manifest file

AndroidManifest.xml

...
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
...

what i do wrong?

Answer

prat picture prat · Nov 9, 2016

add dependency 'com.google.android.gms:play-services-location:9.0.2'