1

I am getting a rather strange ApiException when trying to sign into a Google account from my application. I can reproduce this only on a device that is in Alpha testing that has had a previous version of the application (without Google sign in option). If I do a clean install on an emulator or a real device there is no problem getting authenticated. It might be messed up from some of the previous (faulty) versions that were in Alpha testing and I don't want to reinstall it on this device as it is the only way I can currently reproduce it.

According to Google's documentation, the value I get is:

public static final int CANCELED: The result was canceled either due to client disconnect or cancel(). Constant Value: 16

I can assure you that this doesn't happen explicitly neither in the code nor by me when testing it. As I said, I have already tested it on one other physical device and on several emulated devices and I can authenticate multiple accounts fine.

Has anyone faced this error and does anyone have any ideas as to why might I get it?

Sorry for the way I attached the logs but I can't get them any other way:

enter image description here

  • please check the SHA1 is added in console or please try with Web client (auto created by Google Service) from google project cloud console instead of android it will work . – RAHULRSANNIDHI Oct 04 '18 at 08:58

1 Answers1

0

It turns out that, if the application is deployed on the Google Play Store, the SHA1 signing key is different to the one produced from Android Studio (which the documentation says you should use).

All I had to do to fix this was locate the SHA1 App Signing Certificate for my application (from Google Play Console: Release Management -> App Signing) and create a new OAuth2 Android credential in the cloud console with this key, as well as add it to the Firebase console under the project's settings.