GoogleApiClient cannot be resolved

Karthikeyan Ve picture Karthikeyan Ve · Jul 16, 2014 · Viewed 11.4k times · Source

I am working in Google App Indexing for my project.

Newbee for this feature. I just following the google guide lines.

Notify the google using API

In this page,asked to create an instance of GoogleApiClient. I tried but getting "GoogleApiClient cannot be resolved a type" error.

And I have added the following libraries into my project.

1.Google play services 2.Google api client 3.Google http api client

Installed Google APIs

and

Libraries included

the error is

Error image

How can I resolve this error?

Answer

live-love picture live-love · Aug 17, 2015
  • Copy the library project at /extras/google/google_play_services/libproject/google-play-services_lib/ to the location where you maintain your Android app projects (your projects folder).
  • Import the library project into your Eclipse workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it (browse to the google-play-services_lib folder).
  • In your app project, reference Google Play services library project (right click on project, Properties, Android, click on Add..., select google-play-services_lib folder).
  • After you've added the Google Play services library as a dependency for your app project, open your app's manifest file and add the following tag as a child of the element (this is a new requirement as of updated Google Play Services):

    <meta-data android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" /> 
    

Then add this statement in your class (or fix the error):

import com.google.android.gms.common.api.GoogleApiClient


For Android Studio, follow directions here:

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