简体   繁体   English

使用Google+ API登录Android应用

[英]Using Google+ API for login in Android app

I'm trying to use Google+ API for login in my Android app. 我正在尝试使用Google+ API登录我的Android应用。 I already enabled the API for my account but now I'm facing problem with initializing the PlusClient. 我已经为我的帐户启用了API,但现在在初始化PlusClient时遇到了问题。

I'm following this directions https://developers.google.com/+/mobile/android/getting-started#step_3_initialize_the_plusclient and I need to import this into my project: 我遵循以下指示https://developers.google.com/+/mobile/android/getting-started#step_3_initialize_the_plus客户端 ,我需要将其导入到我的项目中:

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;

Sadly Eclipse is showing this error for each input: 不幸的是,Eclipse对于每个输入都显示此错误:

The import com.google.android.gms cannot be resolved 导入com.google.android.gms无法解析

My build target is set to Google APIs 17, google-play-service_lib is added as library, there is also android-support-v4.jar and I have no clue what is wrong. 我的构建目标设置为Google API 17,将google-play-service_lib添加为库,也有android-support-v4.jar,我不知道出了什么问题。

Check that your project is correctly using google-play-services_lib as a library. 使用google-play-services_lib作为库,检查您的项目是否正确。

In Eclipse, go to Project > Properties > Android and check that google-play-services_lib is listed under the Library section - and that it has a green tick next to it, not a red cross. 在Eclipse中,转到“ 项目”>“属性”>“ Android”,然后检查“ google-play-services_lib”是否在“库”部分下列出-并在其旁边有一个绿色的勾号,而不是一个红色的叉号。

If google-play-services_lib has a red cross next to it, select it and click Remove . 如果google-play-services_lib旁边有红叉,请选择它,然后单击删除 Then re-add it. 然后重新添加。

To add google-play-services_lib if it is missing, click Add... and Eclipse will list the available library projects in your workspace. 要添加缺少的google-play-services_lib,请单击添加... ,Eclipse将列出工作区中可用的库项目。 Select google-play-services_lib and click OK. 选择google-play-services_lib ,然后单击确定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM