12500, an Android Developer’s nightmare…
Tags: android, debugging, firebase, googlesignin
Published: 2019-08-12 17:51:27

I was Developing and Android App which provides sign-in with both Facebook and Google using Firebase Authentication services, So i started coding and covered everything the documentation recommended. After finishing everything I was optimistic enough that everything will work just fine, well Facebook worked well but Google Sign-in applied the known saying :
> It never works the first time

At first I thought it is just a casual error and tried to understand it, I obviously checked Stackoverflow, GitHub issues and the official documentation but it wasted hours and hours of my time with no solution, and that’s what pushed me to write an article about how to fix it…

## Debugging the error
### Attempt 1 : Checking if I missed enabling Google Sign-in on Firebase

Although I was 100% sure that I did enable it but I checked anyway, all I had to do is heading over to my Firebase console, choosing my App and under Authentication » Sign-in method, checked if Google Sign-in was enabled or not.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/tk3giz4aat6suv4sw67y.png)

**— Hypothesis dismissed 👎**

### Attempt 2: Checking if the project support email is configured

Well After some Googling I found out that the support email should be provided in order for the Sign-in to work, I knew I didn’t configure it so I applied the following process to add it :
In my App in the Firebase console, and under Authentication » Sign-in method, and having enabled Google Sign-in, I selected the Google Sign-in option. And finally added the support email.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/oteryo7lhbx8rhab2gau.png)

After adding the support email, I was optimistic enough that I fixed the issue, I rebuilt the App and tested it again but there were the surprise 12500 shows up again…
**— Hypothesis dismissed 👎**

### Attempt 3: Checking if the SHA-1 (certificate fingerprint) is configured correctly

Along the Googling process for for the causes of my problem, the SHA-1 issue showed up several times but I was sure enough that it was well configured that I gave priority to other hypotheses, anyway after all the previous attempts didn’t resolve the issue (wasting hours of my time) I decided to check with the SHA-1 as a last hope…
I was desperate enough to regenerate the SHA-1 using several methods, (you can check [this](https://medium.com/pen-bold-kiln-press/sha-1-android-studio-ec02fb893e72) or the [official documentation](https://developers.google.com/android/guides/client-auth)) in order to double or triple check the SHA-1. As common sense says the SHA-1 were the same in every and each attempt…

To add the SHA-1 to your App you can check [this](https://stackoverflow.com/questions/39144629/how-to-add-sha-1-to-android-application/47783568).

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/y12yv14a140ozx1ht87i.png)

PS: make sure to update the google-services.json file each time you change the SHA-1.
Anyhow, no matter the times i changed the SHA-1 the 12500 kept showing…
**— Hypothesis dismissed 👎**


### Attempt 4: Add an application logo to your project in the [Google Cloud Platform](https://console.developers.google.com/apis/) console

After doing all the above, I lost hope of resolving the issue and even started thinking of starting a new project hoping to not face the issue again, but I decided to use the power of communities and ask for help, I posted about the issue in several slack workspaces and work on other things while waiting till someone replied suggesting to add a logo in my Firebase app’s configuration, Something I never thought would cause such an error, but I tried it anyway since I had no other choice, by doing the following :

In my Google Cloud Platform, and after selecting my project, on the left navigation bar, under Credentials » OAuth consent screen, I scrolled down to the application logo section, and added a random picture to just test it then clicked save, tried the App debugging version that existed in my phone already and it really worked.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/43tgakdde5bk9hakwzql.png)

I still don’t know why, but the Firebase application’s logo seems to be a necessary thing for Google Sign-in…
**— Hypothesis is the Eurêka !!! 👍**

## Final thoughts

As you can see, it was not easy at all to find the cause of the bug. This is one of the moments that pushes you to think out of the box and surely convince you how helpful the community can be.

These are some of the lessons I learned because of this experience :

* Error messages are neither 100% correct nor clear. (Showing a 12500 error with no details is not helpful at all).
* Reading carefully the Android documentation is not easy but it’s very important so you can understand how it works but sometimes they can be not helpful at all.
* As a Developer, being an expert Googler is something crucial…
Developers Communities are great thanks to all the people sharing their experiences and trying to help whoever in need.
* It is not always something logical that causes the error, think out of the box and expect everything.
* Errors do waste time but they give you lessons and experiences that you can’t deny their importance.

That’s it, I hope you like it and find it useful at some point. I would really appreciate your feedback and if you needed any help just give me a DM.