【问题标题】:Android PlusOneButton does not initializeAndroid PlusOneButton 未初始化
【发布时间】:2013-11-06 14:25:06
【问题描述】:

我正在尝试在我的 Android 应用中包含一个 PlusOneButton。 如 google (https://developers.google.com/+/mobile/android/getting-started?hl=en) 所述,我使用 debug.keystore 中的 SHA-1 在 google 云控制台上创建了该应用程序。

在我的 XML 布局中,我添加了 +1 按钮:

<com.google.android.gms.plus.PlusOneButton
    android:id="@+id/btnPlusOne"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    plus:size="standard" />

在我的活动中,我重写了 onResume() 方法。当然,我首先通过 findViewById(...) 检索对象:

public void onResume() {
    super.onResume();
    btnPlusOne.initialize("http://www.google.de", REQUEST_CODE_PLUS_ONE);
}

我也在 Manifest 中授予权限:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />

但如果我启动我的应用程序,PlusOneButton 看起来是灰色的。如果我点击它,按钮中会出现一个进度条并无限运行。在 Logcat 上,我收到以下消息:

18367-18367/? W/PlusOneButtonView﹕ Failed to establish connection with status: 8

如果我在 API-Doc (http://developer.android.com/reference/com/google/android/gms/common/ConnectionResult.html#INTERNAL_ERROR) 中检查它,它会说类似于内部错误。但目前我不知道什么可以解决这个问题?

【问题讨论】:

  • @chirstopher 我在这里遇到同样的问题。我会在我修复时告诉你。如果你先修复,请告诉我
  • @DivyaRamakrishnan 当然。但目前我真的卡住了。
  • @Christopher 你找到任何解决方案了吗?似乎是一种非常奇怪的行为
  • @RahulVerma 对不起。问题仍然存在,但我没有任何解决方案。 :(

标签: android google-plus google-plus-one


【解决方案1】:

随着新的 Google Play Services 4.1 版本的发布,这个问题在我的案例中得到了解决。

https://code.google.com/p/google-plus-platform/issues/detail?id=704

【讨论】:

    【解决方案2】:

    该按钮被冻结,因为随着谷歌播放服务库的新更新,您只能在用户登录时 +1。以前的库更好,因为它在单击 +1 按钮时登录用户,但使用新的您必须先登录用户,然后才会激活 google plus 按钮。谷歌同事告诉我他们正在努力解决这个问题,但我们仍然不知道更新什么时候准备好。

    因此,如果需要 google 加号登录,您可以包含登录按钮,然后加号可以正常工作,但仅为加号添加登录按钮似乎无关紧要。我希望 Google 能尽快解决这个问题。

    【讨论】:

      猜你喜欢
      • 2019-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-08
      • 1970-01-01
      • 2020-12-26
      • 2021-07-11
      相关资源
      最近更新 更多