Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sign-in with google for android not working in release apk

I have added the Google Sign in in my application and made it work by following all the steps in the official documentation. Everything worked fine, until I generated a signed apk for publishing. The app could not sign in , the

Log.d(TAG, "handleSignInResult:" + result.isSuccess());

in SignInActivity.java's handleSignInResult() gives the value as false.

I have registered the app on the developer console and provided the SHA1 key for they debug key as well as the release key. I am unable to solve this and couldn't find anything related in the documentation either.

like image 956
huskygrad Avatar asked Feb 22 '16 18:02

huskygrad


2 Answers

When you upload an apk to the play store then play store creates a new SHA1 key called "App signing certificate". You get that SHA1 and save in your console or firebase account (as you need).

New SHA1 will be found at Released Management->App Sigining on your play console.

or

when you build signed apk with your filename.jks it has different SHA than your debug apk, put these SHA which is generated by signed apk in Firebase nd update it and again download json from firebase and override existing json from your android studio.

Before publishing app you should read Google Play launch checklist

For complete release process you can go here

like image 200
Ameya Salagre Avatar answered Nov 10 '22 16:11

Ameya Salagre


Finally solved it. I added the SHA1 key for my release key (the .jks file) in the Google Developers Console under the project registered. In Android Studio, at the left side, there is an option for Build variants under the project view. There, I changed each module to release mode (it is in debug mode by default). Then created the Signed APK by usual method, and run the app. The Google Signin worked perfectly.

Changing the build variants

like image 26
huskygrad Avatar answered Nov 10 '22 14:11

huskygrad