I'm working with AndroidStudio and trying to use the googleplayservices for geocode.
I've followed the android tutorial: http://developer.android.com/google/play-services/setup.html
but in my imports i've got underlined : import android.location.LocationClient; that says: Cannot resolve symbol Location Client
Any ideas?
My code goes as next:
//imports
...
import android.location.Location;
import com.google.android.gms.location.LocationClient;
import android.location.LocationClient;
...
build.grandle
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile files('libs/android-async-http-1.4.6.jar')
compile 'com.google.android.gms:play-services:6.5.87'
}
...
and finally my xml manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.name.application_name" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.READ_LOGS"/>
....
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
....
There is no LocationClient
in package android.location
. This is why your import is resulting in an error.
In fact, the LocationClient
class is deprecated. From Google Play Services | Android Developers:
Deprecated clients - The
ActivityRecognitionClient
,LocationClient
, andPlusClient
classes are deprecated. If you used those APIs in your app and want to call Google Play services 6.5 or higher APIs, you must switch to the new programming model that utilizesGoogleApiClient
. For more information about usingGoogleApiClient
, see Accessing Google APIs.Use these APIs instead of the deprecated APIs:
...If you were previously using
LocationClient
, call the APIs in thecom.google.android.gms.location
package instead.
For quick information on migrating from LocationClient
to GoogleApiClient
, see android - LocationClient class not found on google play services rev 22