15

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.

huskygrad
  • 1,257
  • 1
  • 10
  • 21

3 Answers3

24

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

Ameya Salagre
  • 773
  • 10
  • 21
  • 1
    Your answer is confusing because if you want to upload APK into playstore then you need use the keystore for signing. We only use that keystore file SHA1 value for firebase or any 3rd party services – VinayagaSundar Jun 29 '17 at 08:52
  • 2
    after your publish your apk in playstore, it wont work for your google service until you put SHA1 generated by playstore in your firebase account. For Firebase Debug SHA is different Release SHA is different(Signed APK) Playstore SHA is different. Your firebase services work only after you put playstore SHA in Firebase settings. i was experiencing this problem, when i release my app on playstore it was not working for google sign in service, to make it working you have to put SHA1 generated by playstore in firebase settings. @VinayagaSundar – Ameya Salagre Jun 29 '17 at 10:11
  • 3
    thanks. i just add SHA1 from Google Play App Signing on firebase and update google_services.json on app. Thanks – Guihgo Aug 21 '17 at 02:18
  • @Guihgo Did it fix the issue? – Amar Ilindra Aug 22 '17 at 07:01
  • 1
    @AmarIlindra yeap ! – Guihgo Aug 22 '17 at 22:24
  • 1
    Thank you so much, You saved my day@AmeyaSalagre – urvi joshi Sep 04 '17 at 14:14
  • I am unable to find new SHA on google play console as well as .jks file. please help – Priya Jagtap Sep 07 '17 at 12:28
  • You will get New SHA1 at Released Management->App Sigining on your play console. @PriyaJagtap – Ameya Salagre Sep 07 '17 at 13:35
  • Its only showing options for Export, encrypt, and upload your app signing private key.,Generate and register your new upload public key,Enroll in Google Play App Signing. There is no direct way to get SHA1. @ Ameya Salagre – Priya Jagtap Sep 08 '17 at 05:50
15

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

huskygrad
  • 1,257
  • 1
  • 10
  • 21
  • 1
    where to add SHA1 key in developer console?? can u gve me exact path??? and how to find SHA1 key...help..its urgent – Elizabeth May 03 '16 at 07:44
  • for me..in studio its already in release mode bu still handleSignInResult:false coming..what to do??? any suggestions??? – Elizabeth May 03 '16 at 07:52
  • Go to your developer console https://console.developers.google.com, click on the icon to top left to open the drawer, click on API manager. Go to the Google+ aPI under Socil API. Enable it. Click on Credentials at the left in the drawer. If you see any credentials added already click on them and in the details you will see a field for adding SHA1. Otherwise click on Create Credentials > OAuth Client ID > Select Android. Fill the necessary details and save. – huskygrad May 03 '16 at 11:17
  • yes..i did that but still issue http://stackoverflow.com/questions/36999751/google-signin-not-working-in-release-mode-apk-android/ can you help me??? – Elizabeth May 03 '16 at 11:19
  • whether we have to add this key somwhere in the android code? manifest???if so where?? – Elizabeth May 03 '16 at 11:22
  • @SanketPimple How did you change it to release mode? – Paula Kristin May 12 '16 at 08:58
  • @PaulaKristin check my edit, I have added an image. Read the answer again, you'll get it. – huskygrad May 13 '16 at 08:41
  • @SanketPimple did you use Firebase? – Aditya Vyas-Lakhan Apr 27 '17 at 11:22
  • Please Provide acurate path. Where to add new release SHA 1 Key in developer console ?? can you give me exact Path .............. how to find release SHA 1 key – Keshav Gera Aug 17 '18 at 09:52
-1

Go to C:\Program Files\Java\jdk-17 [Java jdk/bin location]. Open cmd as administrator

Follow Steps:

cd C:\Program Files\Java\jdk-17

keytool -list -v -keystore "KEY STORE PATH" -alias "KEY ALIAS"

Enter Password

Done!

desertnaut
  • 57,590
  • 26
  • 140
  • 166