【问题标题】:Google+ Share Error Code 8Google+ 分享错误代码 8
【发布时间】:2014-12-28 21:35:51
【问题描述】:

在实现 Google+ 分享时,我在 onCreate 中执行以下操作:

mGoogleClient = new GoogleApiClient.Builder(this)
    .addApi(Drive.API)
    .addScope(Drive.SCOPE_FILE)
    .addScope(Plus.SCOPE_PLUS_LOGIN)
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this)
    .build();

我在按钮上onClick 后与 Google 建立联系:

mGoogleClient.connect();

然后调用回调:

@Override
public void onConnectionFailed(ConnectionResult result) {
    // TODO Auto-generated method stub
    Log.e("GoogleClient","connection failed!");
    Log.e("result",""+ result.getErrorCode());
    if (result.hasResolution()) {
        try {
            result.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
        } catch (SendIntentException e) {
            mGoogleClient.connect();
        }
    }
    // Speichern Sie das Ergebnis und beheben Sie den Verbindungsfehler bei einem Klick des Nutzers.
    mGoogleConnectionResult = result;

}

我得到错误代码812-28 22:39:56.286: E/result(15533): ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null}

我将我的 APK 添加到 Google 并获得了有效的发布密钥。我知道这是因为我第一次尝试分享它就像一个魅力,我能够在我的Google+ page 上分享。如果我再试一次,没有任何反应,甚至没有出现Choose Google-account 对话框。如果我卸载我的应用程序并重新安装它然后重试,当我选择我的Google Account 时出现Choose Google-account 对话框,就像我第一次得到错误代码8 -----> 12-28 22:39:56.286: E/result(15533): ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null} 一样。

我得到了最新的 Android SDK 和最新的Google Play Services

感谢任何帮助。

【问题讨论】:

  • 根据developers.google.com/+/mobile/android/share,您不需要调用`connect()`。你只需要启动一个 Intent。
  • @joao2fast4u 确实如此。它解决了问题,现在它每次都像魅力一样工作。您可以将其发布为我将标记为已接受的答案。但无论如何,googe+ share 不需要连接只是运气。有趣的是,为什么在尝试连接时这不起作用..非常感谢!

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


【解决方案1】:

根据Google Developers website,您无需拨打connect()Google Plus分享。你只需要发起一个分享Intent

编辑:关于您的上一条评论,您的问题的可能原因已解释为here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-18
    • 1970-01-01
    • 2017-01-18
    • 2016-10-26
    • 1970-01-01
    • 1970-01-01
    • 2016-05-15
    • 1970-01-01
    相关资源
    最近更新 更多