0

I'm developing an android application that provide to users login with Facebook with firebase help, my problem is when i generate signed release APK the login stops from working and i look up for some solutions i found all the solutions the same which is generate a key hash from this code:

keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | PATH_TO_OPENSSL_LIBRARY\bin\openssl sha1 -binary | PATH_TO_OPENSSL_LIBRARY\bin\openssl base64

and i did it like a 1000 times each time i open cmd or android studio terminal and i navigate to my JDK location so i can access keytool.exe to run the command above and i copy and paste the key hash into my facebook developer account in Settings -> basic and then open android app section and paste the key hash in "Key Hashes" field, so my problem again Facebook login not working after generating signed release apk in android.

Mostafa Amer
  • 143
  • 1
  • 10
  • Can you describe your process of using the APK after creating the signed release? Are you uploading it to google play or are you installing the application directly from the apk? Google Play may be signing your app again depending on the settings – JensV Apr 14 '20 at 08:09
  • 1
    You can also get the SHA1 from the finished apk by following this: https://stackoverflow.com/a/11331951/2232127 – JensV Apr 14 '20 at 08:10
  • @JensV i upload it to Google play yes, but i'm testing facebook login using different apk version on physical device. – Mostafa Amer Apr 14 '20 at 08:13
  • Are you using the debug variant when testing on your device? Because that is signed using your debug key which is different for each development machine (your computer). You need to get the signature from the debug keystore. – JensV Apr 14 '20 at 08:18
  • my problem with release apk not with debug apk! @JensV – Mostafa Amer Apr 14 '20 at 08:25
  • Sorry, I updated my answer to include both the debug and release by google play version solution – JensV Apr 14 '20 at 08:26
  • @JensV i want to test facebook login with the release apk not the debug apk, it works fine on debug apk. – Mostafa Amer Apr 14 '20 at 08:26
  • Read the last section of my solution – JensV Apr 14 '20 at 08:28

1 Answers1

1

If you have the APK

You can just extract the signature from the built apk. It's usually located after building in <projectDir>/app/build/outputs/apk/* by using the answer from this question.

Get signature for debugging

When debugging your app you are signing the app with the debug keystore. This is located in ~/.android/debug.keystore on Linux/Mac OS or in C:\Users\user\.android\debug.keystore on Windows.

When using Google App Signing

See the below screenshot to check if you are using Google App Signing. If it's enabled, use the signature information provided by Google.

Google App Signing screenshot

JensV
  • 3,481
  • 1
  • 18
  • 36