0

I'm trying to use this relatively new :play-services-identity-credentials library (release notes):

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.

But whatever I try with that IdentityCredentialClient, this is the default result; thrown by 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)

While 17 generally means CommonStatusCodes.API_NOT_CONNECTED:

The client attempted to call a method from an API that failed to connect.

The code which produces this ApiException is available on GitHub. Adding google-services.json did not solve the problem. On the console there's only an "Identity Toolkit API" available. So how can I enable and/or even connect that Identity Credentials API?

2 Answers 2

0

This also needs credentials-play-services-auth, which even depends on it.

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")
0

If you are in a Kotlin Multiplatform project, the location of the google-services.json file is different.

KMP Project with AndroidApp or Android-only:

- androidApp
  - kotlin
    - com.example.test
  - AndroidManifest.xml
  - google-services.json # <== HERE
+ composeApp # or shared
+ iosApp

KMP Project without AndroidApp:

- composeApp
  - src
    - androidMain # or "main"
      + kotlin
      + res
      - AndroidManifest.xml
      - google-services.json # <== HERE
    + commonMain
    + iosMain
+ iosApp
1

Not the answer you're looking for? Browse other questions tagged or ask your own question.