Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Resolve Symbol Google API Client in Android Studio

Tags:

I'm getting an error in Android Studio for the following:

mGoogleApiClient = new GoogleApiClient.Builder(this)                 .addConnectionCallbacks(this)                 .addOnConnectionFailedListener(this)                 .addApi(LocationServices.API).build(); 

I have put this in my manifest, <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

and compile 'com.google.android.gms:play-services:6.5.87' in my gradle dependencies.

I've downloaded the required sdk files as well.

Why do I still get this error?

like image 678
Dmac Avatar asked Mar 06 '15 02:03

Dmac


People also ask

What is Cannot resolve symbol in Android Studio?

Most often “R cannot be resolved” error appears if there is an issue with some of your resource files. Due to this error, you are unable to build your application. That's why we need to solve this error as it not getting away by just doing a simple restart or hitting Alt+Enter.

What is Google API Client?

Figure 1: An illustration showing how the Google API Client provides an interface for connecting and making calls to any of the available Google Play services such as Google Play Games and Google Drive. To get started, you must first install the Google Play services library (revision 15 or higher) for your Android SDK.

Is GoogleApiClient deprecated?

Yeah GoogleApiClient has been deprecated. Particularly for the authentication api, you now need to use GoogleSignInClient .


1 Answers

For the benefit of searchers:

If you are following the android tutorial that relates to this, you can add the dependency via the UI.

  1. In Android Studio, go to File > Project Structure.
  2. Go to the dependencies tab.
  3. On the right hand side add a 'Library Dependency'.
  4. Type "com.google.android.gms:play-services" into the searchbox and pick the appropriate dependency.
  5. Then follow @Dmac's answer
like image 61
JsAndDotNet Avatar answered Sep 24 '22 16:09

JsAndDotNet