0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Misuse of Sign in with Google API: Use of `:googleid` classes without use of `GoogleIdTokenCredential`

Last updated at Posted at 2024-10-03

Ladybug2024.2.1にアップデートしたところ、Lintが次のメッセージで失敗するようになりました。

Error: Use of :googleid classes without use of GoogleIdTokenCredential [CredentialManagerSignInWithGoogle]
          val googleIdOption = GetGoogleIdOption.Builder()
                               ~~~~~~~~~~~~~~~~~
  
     Explanation for issues of type "CredentialManagerSignInWithGoogle":
     When using :googleid classes like GetGoogleIdOption and
     GetSignInWithGoogleOption, you typically must handle the response using
     GoogleIdTokenCredential.TYPE_GOOGLE_ID_TOKEN_CREDENTIAL or
     GoogleIdTokenCredential.TYPE_GOOGLE_ID_TOKEN_SIWG_CREDENTIAL.
  
     This check reports all uses of these :googleid classes if there are no
     references to GoogleIdTokenCredential.
  
     https://developer.android.com/identity/sign-in/credential-manager-siwg#create-sign

メッセージを読む限り、本来の意図としては
val googleIdOption = GetGoogleIdOption.Builder().build() がある場合に
GoogleIdTokenCredential.TYPE_GOOGLE_ID_TOKEN_CREDENTIAL
があるかどうかを確認しているようです。

しかし、テストコードを読むと、次のような記述があります。

    // The code that references the Google ID classes is in a library module;
    // the warning should still be reported when we reach the app module.

どうやら、ライブラリモジュール内でGoogle IDへの参照があると警告を出すようです。

(ここからは個人の意見です)
UIレイヤで実行すべき、というのは理解できますが、アプリケーションモジュールで必ず実行しないといけない、というのは制約としてやや強すぎる気がします。
一時的な対処として CredentialManagerSignInWithGoogle のLintをdisableにして様子を見るのが良さそうです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?