0

I am making an app that contains a "share to facebook"-button, and am about to publish it soon. To do that, I know I need to add a release key hash in my app's settings in the facebook developer console. Following the steps in facebook's developer documentation here, they say:

When publishing your app, it is typically signed with a different signature to your development environment. Therefore, you want to make sure you create a Release Key Hash and add this to the Android settings for Facebook App ID.

And then, also as answered here, facebook want me to run the following command:

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

Does this mean I should sign my release build before following facebook's guide in order to get this release key path?

What is release key alias, is it just a name that is only used here or do it need to match something else I've entered somewhere?

What is "Class Name" that they want me to enter in the facebook settings. Is it the name of the activity which will launch the share-to-facebook intent? The tip says "The Main Activity you want Facebook to launch". How should I know what their activity is called? I don't want Facebook to launch one of my activities, I want to launch one of theirs...

How can I confirm that it works once I've set a valid release key hash in facebook developer settings?

Wu Wenjun
  • 107
  • 2
  • 11
  • Easiest way will be , generate signed apk . Install it on your phone , make sure your phone has facebook app . try to login with facebook in your app . with it throw an error that hash key does not match . just copy the key now shown in facebook app – Manohar Jun 15 '18 at 07:37

2 Answers2

2

What is release key alias, is it just a name that is only used here or do it need to match something else I've entered somewhere?

RELEASE_KEY_ALIAS - > alias name in the keystore(.jks) which used to sign the apk

Does this mean I should sign my release build before following facebook's guide in order to get this release key path?

RELEASE_KEY_PATH -> path to the keystore(.jks) file which used to sign the apk

You can find complete step to step guide over here

https://stackoverflow.com/a/46241386/6478047

Manohar
  • 22,116
  • 9
  • 108
  • 144
  • Thank you for your reply, but I am getting confused since the link you provided suggests to use debug.keystore and androiddebugkey as alias. Why should I do this when I want a release key hash? – Wu Wenjun Jun 15 '18 at 12:42
  • That is for debug for release , change path in step 5 to your .jks file location and alias to the alias you gave while creating .jks file – Manohar Jun 15 '18 at 13:10
  • Final command will be something like `keytool -exportcert -alias xyzalias -keystore "E:\KeyStore\xyzproject.jks" | "C:\openssl-0.9.8k_X64\bin\openssl" sha1 -binary | "C:\openssl-0.9.8k_X64\bin\openssl" base64` – Manohar Jun 15 '18 at 13:10
  • @ManoharReddy I followed exactly what you told but still no success – Shikhar Mar 18 '19 at 22:56
  • @ManoharReddy: Please Check issue: https://stackoverflow.com/questions/55229354/cannot-generate-correct-facebook-key-hash-for-release-apk – Shikhar Mar 19 '19 at 04:51
1
  1. download "openssl" for windows in zip

https://sourceforge.net/projects/openssl/files/latest/download

  1. extract zip in the path you want.
  2. get path for "bin" folder.
  3. write the path string

That's it

Malek Tubaisaht
  • 1,170
  • 14
  • 16