Generating hash key for app using facebook sdk

旧街凉风 提交于 2019-11-27 10:52:53
Lavanya

Try this:

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

I hope you will get it. I just checked it and I got the prompt for password.

You can use this code block to generate hash key. Put this code block in your onCreate() method.

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

    } catch (NoSuchAlgorithmException e) {

    }
rishi

Just give the command as:

keytool -exportcert -alias androiddebugkey -keystore debug.keystore

and give the keystroke password or android or enter

Here you have to go to the directory structure until ".android" then run this commnad.In general the path is C:\Users\User-name\.android>.

Kislingk

Check three parts in your environment.

  1. where is "debug.keystore"?

    find / -name "debug.keystore"

    if you can't find it, check you eclipse or ADT.

  2. what is alias name?

    keytool -list -v -keystore "PATH_TO_DEBUG_KEYSTORE"

  3. Check if installed openssl

    openssl

If everything is ready, it should prompt for password

If it's not prompting you for password, then first open your terminal and type :

sudo apt install openjdk-8-jre-headless

And then follow the regular way, just type:

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

For password put: android You are all done.

This answer is for debug purpose only, for release purpose use your .jks file to generate hash key.

vikash sain
C:\openssl\bin>keytool -exportcert -alias aliasName -keystore "C:\Users\s\.android\debu
g.keystore" | "C:\openssl\bin\openssl" sha1 -binary | "C:\openssl\bin\openssl" b
ase64
Enter keystore password:  android
GEYtOJobR4NzuxX4iOl/yR6sla4=
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!