0

I've tried to implement the following SO answer: Facebook Android Generate Key Hash.

13) Again copy following code and paste

openssl base64 -in debug_sha.txt > debug_base64.txt

When I try point 13 (above), I get the error:

openssl.exe has stopped working.

I've also tried using:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

but I get the error:

Illegal option: Alami.android\debug.keystore keytool -list [OPTION]...
Community
  • 1
  • 1

2 Answers2

2

You can directly create it programatically.

Just add this code in your onCreate method.

try {
            PackageInfo info = getPackageManager().getPackageInfo(
                    "com.package.mypackage", 
                    PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
                }
        } catch (NameNotFoundException e) {

        } catch (NoSuchAlgorithmException e) {

        }

And you will get keyhash in Log.

Jay Rathod
  • 11,131
  • 6
  • 34
  • 58
  • i don't understood with this method -_- – Arif Alami Mar 24 '16 at 12:20
  • @ArifAlami Have you tried to generate keyhash with this method ? – Jay Rathod Mar 24 '16 at 15:07
  • @ArifAlami Just try this code as i have suggested it will give you keyhash to add in your facebook project. – Jay Rathod Mar 25 '16 at 08:06
  • when the app running, i got a problem when i login to FB. it say "Invalid Scopes: publish_steam. this message is only shown to developers. users of your app will ignore these permision if present. plaese read the documentation for valid permision at /developers.facebook.com/docs/facebook-login/permisions" – Arif Alami Mar 27 '16 at 02:37
0

try to download openssl from here than execute

keytool -exportcert -keystore YOUR_PATH_HERE/.android/debug.keystore | PATH_TO_BIN_FOLDER_OF_SSL_DIRECTORY_IN_C:/openssl.exe sha1 -binary | PATH_TO_BIN_FOLDER_OF_SSL_DIRECTORY_IN_C:/openssl.exe base64
Helmi
  • 90
  • 5