【问题标题】:Android The import com.google.android.gms.plus.PlusClient cannot be resolvedAndroid 导入 com.google.android.gms.plus.PlusClient 无法解析
【发布时间】:2015-07-27 13:03:20
【问题描述】:

我更新并导入了 google-play-services_lib 项目并将这个库添加到我的项目中仍然显示相同的错误导入 com.google.android.gms.plus.PlusClient 无法解决

import com.google.android.gms.plus.PlusClient; 

而且 PlusClient 无法解析为 on 类型

private PlusClient mPlusClient;

【问题讨论】:

  • 你在用eclipse吗?
  • 检查 google-play-services_lib 项目是基于 gradle 的项目吗?
  • 只有基于 Eclipse 的项目。

标签: android google-plus google-play-services


【解决方案1】:

PlusClient 在更新的播放服务中不可用。

来自this link

  private GoogleApiClient buildGoogleApiClient() {
    // When we build the GoogleApiClient we specify where connected and
    // connection failed callbacks should be returned, which Google APIs our
    // app uses and which OAuth 2.0 scopes our app requests.
    return new     GoogleApiClient.Builder(SigninActivity.this).addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this).addApi(Plus.API,   Plus.PlusOptions.builder().build())
            .addScope(Plus.SCOPE_PLUS_LOGIN).build();
}

【讨论】:

  • 像你说的那样添加更改后,当我尝试使用 Person currentPerson = mPlusClient.getCurrentPerson();我正在获取 GoogleApiClient 类型的方法 getCurrentPerson() 未定义。我该如何解决这个问题
  • 点击链接并仔细阅读。你可以在那里得到所有东西。
  • 个人 currentPerson = Plus.PeopleApi.getCurrentPerson(mPlusClient);插入 Person currentPerson = mPlusClient.getCurrentPerson();它对我有用!
猜你喜欢
  • 2015-04-19
  • 1970-01-01
  • 1970-01-01
  • 2017-02-01
  • 1970-01-01
  • 2013-03-18
  • 2015-01-16
  • 2014-02-09
  • 1970-01-01
相关资源
最近更新 更多