Get key hash for Facebook API from APK File not working

I’m trying to get the key hash for the Facebook API from my APK file with the console command (on macOS) from the docs like this:

keytool -list -printcert -jarfile my-apk-file.apk | grep SHA1 | awk '{ print $2 }' | xxd -r -p | openssl base64

But I always get an error about the option -jarfile that say’s that this option is invalide!

If I remove the option, I don’t get anything back from the command…

Does anyone know how to fix this issue?

Hey, same issue here (in fact getting nothing from console). Does anyone succeed ?

Hey,

Got a problem also with : keytool -list -printcert -jarfile YOUR_APK.apk | grep SHA1 | awk ‘{ print $2 }’ | xxd -r -p | openssl base64

I changed it with my apk file I just uploaded on GooglePlay Store.

I have no output in my console. Where do I get it please ? :slight_smile:

ANSWER:

https://ibby.ca/extract-key-hash-apk-file/

It works perfectly !

1 Like

Same problem here, but when I run

keytool -list -printcert -jarfile <filename>.apk

I get this output:

java.utilIlegal.FormaConversionException: d != java.lang.String