Quick Tip: Key Hash For Facebook Android Application in AIR


It may be a little tricky to setup “Native Android App” section for your Facebook application. Especially the field “Key Hashes”. Facebook provides instructions for acquiring debug version hash but is not very clear about how to get one for signed application. There is a lot of valid answers around the internet, but the one I needed was still missing. Imagine this simple scenario where you export and sign (using .p12 cert) your AIR Android project, you have an .apk file and want to get a key hash for facebook. Then I finally found the answer:

  1. Unzip .apk file and extract META-INF\CERT.RSA file
  2. run keytool -printcert -file CERT.RSA
  3. notice SHA1 bytes are printed like 29:37:F1:CB:06…
  4. copy SHA1 bytes into HEX to BASE64 converter
  5. see your BASE64 key hash in output field

11 comments so far

  1. Pedro February 26, 2013 17:15

    Hey Jozef !

    Really nice job .. I expend a a lot of time thinking about why is just working on debug ….
    But i still dont know how i “Unzip .apk file” in my mac .

    Can you give me a light !?



  2. Jozef Chúťka February 26, 2013 17:22

    you can rename file.apk to file.zip and unzip, or you can setup your mac unziping tool to open .apk files for you (not sure how this is done on macs)

  3. koby douek October 9, 2013 06:55

    You are an angel.
    I was looking for 2 days, so many false suggestions. Yours really work. Great job man.

  4. Ran Kornfeld February 24, 2014 18:18

    Great tip!
    Good job

  5. Rafa March 31, 2014 19:02

    THAT WORKS!, i love you so much. INCREDIBLE!

  6. tonypai April 12, 2014 05:35

    You really saved my ass! Appreciate for your sharing. 😀

  7. M.A.D. June 2, 2014 03:07

    This was REALLY helpful! Thanks!!

  8. jason June 25, 2014 22:35

    I am stuck on “run keytool -printcert -file CERT.RSA”.
    Can someone please explain to me how i run this.

  9. Agg December 6, 2014 02:53

    Thanks a lot !

  10. David Jaros April 21, 2015 04:16

    this procedure gave me same hash as command:

    keytool -list -printcert -jarfile [path_to_your_apk] | grep -Po “(?<=SHA1:) .*" | xxd -r -p | openssl base64

    still cannot login to my test users accounts though…

  11. nick May 20, 2015 17:46


Leave a comment

Please be polite and on topic. Your e-mail will never be published.