我正在尝试使用这个相对较新的
:play-services-identity-credentials
库(发行说明):
implementation("com.google.android.gms:play-services-identity-credentials:16.0.0-alpha03")
implementation("androidx.work:work-runtime:2.9.1") // required, else it doesn't work at all.
IdentityCredentialClient
,这都是默认结果;由com.google.android.gms.identitycredentials.internal.IIdentityCredentialCallbacks
抛出:
com.google.android.gms.common.api.ApiException: 17:
at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(com.google.android.gms:play-services-base@@18.4.0:3)
at com.google.android.gms.common.api.internal.TaskUtil.setResultOrApiException(com.google.android.gms:play-services-base@@18.4.0:4)
at com.google.android.gms.identitycredentials.internal.InternalIdentityCredentialClient$registerCredentials$1$callback$1.onRegisterCredentials(com.google.android.gms:play-services-identity-credentials@@16.0.0-alpha03:1)
at com.google.android.gms.identitycredentials.internal.IIdentityCredentialCallbacks$Stub.dispatchTransaction(com.google.android.gms:play-services-identity-credentials@@16.0.0-alpha03:16)
at com.google.android.gms.internal.identity_credentials.zzb.onTransact(com.google.android.gms:play-services-identity-credentials@@16.0.0-alpha03:2)
at android.os.Binder.execTransactInternal(Binder.java:1505)
at android.os.Binder.execTransact(Binder.java:1444)
虽然
17
通常表示 CommonStatusCodes.API_NOT_CONNECTED
:
客户端尝试从连接失败的 API 调用方法。
生成此
ApiException
的代码可在 GitHub 上找到。
添加google-services.json
并没有解决问题。在控制台上只有“Identity Toolkit API”可用。那么我如何启用和/或什至连接该身份凭证 API?
credentials-play-services-auth
,这甚至取决于它。
implementation("com.google.android.gms:play-services-identity-credentials:16.0.0-alpha03")
// required, else it doesn't work at all.
implementation("androidx.work:work-runtime:2.9.1")
// required, else it will throw ApiException 17.
implementation("androidx.credentials:credentials-play-services-auth:1.5.0-alpha05")