Вход в Android Google+ не работает - statusCode = SIGN_IN_REQUIRED

Я пытаюсь позволить пользователю войти в систему с Google+. Я создал проект в консоли разработчика Google, получил идентификатор клиента и установил сервисы Google play в Android Studio. (Мое работающее устройство имеет Android 4.4.2) Когда приложение работает, и я нажимаю кнопку входа, появляется всплывающее сообщение: «Внутренняя ошибка»

Ошибка в Logcat заключается в следующем:

error ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{429ffe38: android.os.BinderProxy@429ffdd8}}

Обратите внимание, что эта ошибка появляется до того, как пользователь нажал кнопку, на самом деле, путем отладки, я понял, что это происходит из следующего кода строки:

Log.e(TAG, "error " + result.toString());

который находится в методе:

public void onConnectionFailed(ConnectionResult result) {
    if (!mGoogleIntentInProgress) {
        /* Store the ConnectionResult so that we can use it later when the user clicks on the Google+ login button */
        mGoogleConnectionResult = result;

        if (mGoogleLoginClicked) {
            /* The user has already clicked login so we attempt to resolve all errors until the user is signed in,
             * or they cancel. */
            resolveSignInError();
        } else {
            Log.e(TAG, "error " + result.toString());
        }
    }
}

Вот другие важные методы:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    SignInButton googleLoginButton = (SignInButton) findViewById(R.id.login_with_google);
    googleLoginButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mGoogleLoginClicked = true;
            if (!mGoogleApiClient.isConnecting()) {
                if (mGoogleConnectionResult != null) {
                    resolveSignInError();
                } else if (mGoogleApiClient.isConnected()) {
                    getGoogleOAuthTokenAndLogin();
                } else {
                /* connect API now */
                    Log.d(TAG, "Trying to connect to Google API");
                    mGoogleApiClient.connect();
                }
            }
        }

    });

    /* Setup the Google API object to allow Google+ logins */
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Plus.API)
            .addScope(Plus.SCOPE_PLUS_LOGIN)
            .build();
}

 private void resolveSignInError() {
    if (mGoogleConnectionResult.hasResolution()) {
        try {
            mGoogleIntentInProgress = true;
            mGoogleConnectionResult.startResolutionForResult(this, RC_GOOGLE_LOGIN);
        } catch (IntentSender.SendIntentException e) {
            // The intent was canceled before it was sent.  Return to the default
            // state and attempt to connect to get an updated ConnectionResult.
            mGoogleIntentInProgress = false;
            mGoogleApiClient.connect();
        }
    }
}

 @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RC_GOOGLE_LOGIN) {
        /* This was a request by the Google API */
        if (resultCode != RESULT_OK) {
            mGoogleLoginClicked = false;
        }
        mGoogleIntentInProgress = false;
        if (!mGoogleApiClient.isConnecting()) {
            mGoogleApiClient.connect();
        }
    }


}

Вот код в AndroidManifest.xml

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

И метаданные

   <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

Надеюсь, вы можете помочь мне, большое спасибо!

Ответы на вопрос(1)

Ваш ответ на вопрос