Google sign-in with Firebase authentication fails in the Android Studio emulator
Are you an Android developer that just got a new PC or loaded your developer environment including Android Studio on a different system? Do you use Google sign-in with Firebase authentication in your Android app? You might notice once you to move to the new PC, that's your app's Google sign-in with Firebase authentication fails in the Android Studio emulator when debugging your app. Mine was failing at the getSignedInAccountFromIntent() call. The error I received was 12500 but I couldn't find much more information about what was really going wrong other than the error number.Need new debug SHA1 key in your Firebase console
The problem I found was simply that on a new system you will have a new auto-generated debug SHA1 key from Android studio that needs to be entered in your Firebase console in the general settings page. To do this,- First, open a command prompt on your new system where you are developing your Android app and run the following command to get the SHA1 key. You may need to run the command prompt with administrator privileges:
keytool -exportcert -list -v -alias androiddebugkey -keystore c:\users\<username>/.android/debug.keystore
- Replace <username> with your username.
- You'll be asked for the password which is android.
- Note if keytool isn't found in your path, try looking in C:\Program Files\Android\Android Studio\jre\bin
- Once you run the command above, your new debug SHA1 key will be displayed like the following:
- Copy the SHA key to your clipboard. You can do this by using the mark and copy menu commands:
Command Prompt mark copy menu[/caption]
- Once you have the SHA1 key copied to your clipboard, you can paste it in your Firebase console project's settings (general tab):
Firebase console settings[/caption]
- Scroll down until you see the SHA certificate fingerprint section for your app.
Firebase SHA Certificate Fingerprint[/caption]
- Click Add fingerprint
- And that's it!