google Plus Login Failed error code 17 android

2019-06-10 16:23发布

问题:

I am getting error of google Plus Login Failed error code 17 while using the release apk. In debug apk it is working. not able to figure it out the proper error and solution.Even error message is null.

 @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());
    }

}

回答1:

I finally found answer!

According to google document about Debug & release we have to generate both debug and release SHA-1 fingerprint using the keytool. I also found link.

  • Make sure your package name is what you expect - e.g. its the one in your build.gradle, and its not being overriden in a build variant or product flavor.
  • Make sure you have registered your debug and release SHA1 keys in the console.

Steps followed by me:

For debug SHA-1:

keytool -list -v -keystore -alias For Debug, replace with your debug.keystore path, for Example :

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

Password: android

For Release SHA-1, replace with your keystore path and alias password, for Example :

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

Password: Your alias password.