Я пытаюсь внедрить вход Google в свое приложение, но получаю эту ошибку 'android.content.Intent com.google.android.gms.auth.api.signin.GoogleSignInClient.getSignInIntent()' on a null object reference
.
Я следовал учебному руководству на веб-сайте Firebase здесь -> https://firebase.google.com/docs/auth/android/google-signin
Вот мой код
private void googleSignIn() {
Intent intent = googleSignInClient.getSignInIntent();
startActivityForResult(intent, RC_SIGN_IN);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
GoogleSignInAccount account = task.getResult(ApiException.class);
firebaseAuthWithGoogle(Objects.requireNonNull(account));
} catch (ApiException e) {
Log.w("hhm", "Google signin failed", e);
}
}
}