com.google.android.gms.common.api.ApiException: 10: が発生するのはなぜですか? 質問する

com.google.android.gms.common.api.ApiException: 10: が発生するのはなぜですか? 質問する
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
    try {
        GoogleSignInAccount account = completedTask.getResult(ApiException.class); //exception is here

        // Signed in successfully, show authenticated UI.
        System.out.println("google token ---> " + account.getIdToken());
    } catch (ApiException e) {
        // The ApiException status code indicates the detailed failure reason.
        // Please refer to the GoogleSignInStatusCodes class reference for more information about this error.
        e.printStackTrace();
    }
}

ベストアンサー1

引用:ドキュメンテーション:

特定の Google Play サービス(Google ログインやアプリ招待など)では、アプリ用の OAuth2 クライアントと API キーを作成できるように、署名証明書の SHA-1 を提供する必要があります。

を使用している場合はFirebase、以下を試してくださいdebug app

1. まず、SHA-1デバッグキーを取得します。

  1. クリックしますGradle(右側のパネルにGradleバーが表示されます)
  2. クリックTasks
  3. クリックAndroid
  4. ダブルクリックしますsigningReport(とが表示されSHA-1ますMD5

2. プロジェクトにキーを追加しますFirebase

  1. Project settings-> SHA certificate fingerprints->SHA-1デバッグ アプリのキーの追加に移動します。

  2. google-services.jsonその後、 Android プロジェクト内のファイルを更新できます。

私にとってはうまくいきます。

おすすめ記事