GoogleApiClient cannot be resolved
Solution 1
- 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
Solution 2
If you update SDK all...
- Remove "google-play-services.jar" in libs directory.
- Import google-play-services_lib project in SDK ([your-sdk]\extras\google\google_play_services\libproject\google-play-services_lib)
- Click your Project > Right Click > Properties > Click Android > Click [Add] button in the Library section and add google play library.
- And... Fix the Red alerts(?) :)
I hope this helps you...
Karthikeyan Ve
Updated on June 09, 2022Comments
-
Karthikeyan Ve almost 2 years
I am working in Google App Indexing for my project.
Newbee for this feature. I just following the google guide lines.
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
and
the error is
How can I resolve this error?