import com.google.android.gms.common.api.GoogleApiClient; cannot be resolved

匿名 (未验证) 提交于 2019-12-03 01:49:02

问题:

I want to make a login with Google+ login button like this Tutorial

I have copied the codes, set google_play_services libraries, added package name and SHA1 key in google api console, but there are some import errors :

This import is not an error :

    import com.google.android.gms.common.ConnectionResult;     import com.google.android.gms.common.GooglePlayServicesUtil;     import com.google.android.gms.common.SignInButton;      import com.google.android.gms.plus.model.people.Person; 

But this import an error (cannot be resolved) :

import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.common.api.Status; import com.google.android.gms.plus.Plus; 

Anybody have a solution ?

回答1:

Add this in yourbuild.gradle(app) inside dependency

compile 'com.google.android.gms:play-services:8.1.0' 


回答2:

[Solved]

I try to download new version of google-play-services library and import error is gone.

So, always update/download newest version of google-play-services library..



回答3:

You need to add the dependency to your app. Instructions for eclipse here http://developer.android.com/google/play-services/setup.html

You can also do this by right clicking on your app (if you're using Android Studio) selecting Open Module Settings, going to the dependency tab. Then Clicking the "plus" at the lower left, select library dependency, then find play-services



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!