Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Sign-In suddenly not working

I am working on an Android app that uses Google Sign-In.

Everything was working fine until recently. I stopped working on this project for about two weeks and got back to it yesterday, and the Google Sign-In is suddenly not working anymore. When I click sign in, the Sign-In popup opens, I choose my account and... nothing happens.

So as I did not change anything in the code related to the Sign-In, I started to search everywhere else.

First I noticed that my compile 'com.google.android.gms:play-services-auth:11.4.2' could be updated to 11.6.0, so this is what I did.

I ran the app again and it was now asking me to update Google Play Services, so I clicked on update button but again, nothing happened. I tried multiple times but it didn't change anything. So I started looking somewhere else.

I went to the link where I found the code sample for Google Sign-In to see if anything has changed and... yea it has changed, 10 days ago the sample was updated so I updated my code and now, nothing better, just that the Sign-In popup does not appear now when I click sign in.

So I started looking more deeply at the logs, and here are the problematic lines : W/GooglePlayServicesUtil: Google Play services out of date. Requires 11717000 but found 11577470 W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null} W/LoginActivity: signInResult:failed code=12500

So apparently, it should be related to Google Play Services... Note that I don't get the "Update Google Play Services" popup anymore. Most of the answers that I found regarding this kind of issue suggested to try on another emulator with a lower API, or downgrading Google Play Services compile line, so I tried both. I used to run my tests on a Pixel XL with API 27, I tried on a Nexus 6P with API 25, on this one I can get to the Sign-In popup but when selecting my account I get W/LoginActivity: signInResult:failed code=10. I also tried on two real devices that are OnePlus 3 with API 25 and Samsung Galaxy S6 Edge with API 24, I get the same error on these two than on Nexus 6P. Moreover I don't find anything regarding the meaning of the error code 10. Regarding Google Play Services downgrade, some classes of the new code sample are not recognized if I do so. Also, it seems not to be a Google Play Services issue anymore when trying on devices with lower API than 27.

UPDATE : I found that the error code 10 means "The application is misconfigured". I don't see how since nothing has changed between the time everything worked find and the time it stopped working, anyway I generated a new debug.keystore, a new configuration file and added it to my /app. And obviously it still does not work.

UPDATE 2 : As I tried everything thinkable, and I knew something was wrong with my debug.keystore (I read everywhere that this file should regenerate itself if deleted when building a project, which was not the case for me). I uninstalled/reinstalled Android Studio, hoping that it will at least solve this problem. Well I had tons of files that I don't remember in .android folder and now I have only 1 folder and 2 files, obviously debug.keystore is not one of them. So this made me remember that there is another way of getting the SHA1 signature and this is what I explain in my answer post. But still there is something wrong with my debug.keystore so if anyone has an idea...

like image 402
Benjamin Lesaffre Avatar asked Nov 16 '17 20:11

Benjamin Lesaffre


1 Answers

I finally found a way to get it to work. This is probably not the right solution as there is still something wrong (I will edit the question to explain why), but it works so maybe it could help.

So the problem was coming from the configuration file, and more precisely the debug.keystore used to generate it, indeed, I tried to generate the SHA1 signature required to get the configuration file by running signingReport in the Gradle panel, instead of running the keytool -exportcert -list -v \ -alias androiddebugkey -keystore ~/.android/debug.keystore command and now it works again.

I still don't get how this issue appeared initially since I didn't change anything...

like image 172
Benjamin Lesaffre Avatar answered Nov 02 '22 15:11

Benjamin Lesaffre