google Plus 登录失败错误代码 17 android

google Plus Login Failed error code 17 android

我在使用发行版 apk 时收到 google Plus 登录失败错误代码 17 的错误。在调试 apk 中它正在工作。无法找出正确的错误,solution.Even 错误消息为空。

 @Override
public void onConnectionFailed(ConnectionResult result) {
    Log.e(TAG, "Google plus login failed : onConnectionFailed");
    if (!mIntentInProgress && result.hasResolution()) {
        try {
            mIntentInProgress = true;
            mActivity.startIntentSenderForResult(result.getResolution()
                    .getIntentSender(), AUTH_CODE_REQUEST_CODE, null, 0, 0, 0);
        } catch (SendIntentException e) {
            mIntentInProgress = false;
            mGoogleApiClient.connect();
        }
    } else {
        if (mGoogleLoginListener != null) // it goes here
            mGoogleLoginListener.googlePlusLoginFailed(result.getErrorCode());
    }

}

我终于找到答案了!

根据 google 有关 Debug & release we have to generate both debug and release SHA-1 fingerprint using the keytool. I also found link 的文档。

  • 确保您的包裹名称符合您的预期 - 例如它在 您的 build.gradle,并且它没有在构建变体中被覆盖或 产品风味。
  • 确保您已在中注册调试和发布 SHA1 密钥 控制台。

我遵循的步骤:

调试 SHA-1:

keytool -list -v -keystore -alias 对于调试,替换为您的 debug.keystore 路径,例如:

keytool -list -v -keystore C:\Users\Desktop.android\debug.keystore -alias androiddebugkey

密码:android

对于 Release SHA-1,替换为您的密钥库路径和别名密码,例如:

keytool -list -v -keystore C:\ProjectTest\keystore\my-release-key.jks -alias alias_name

密码:您的别名密码。