Generating release key hash in Linux OS(Ubuntu) : Android Facebook SDK
Asked Answered
T

2

12

How can I generate the right release key hash in Ubuntu? I have already referred this but i can't get my answer.

Torture answered 12/10, 2015 at 4:48 Comment(2)
The solution you refer to is exactly what you need. Were you able to run the command?Seclusive
@Seclusive i got both solution which i looking for.ThanksTorture
T
24

After trying many time i got solution for fragment which give me a release key hash.

try {
        PackageInfo info = getActivity().getPackageManager().getPackageInfo(
                "com.yourappname.app",
                PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.d("KeyHash", "KeyHash:" + Base64.encodeToString(md.digest(),
                    Base64.DEFAULT));
            Toast.makeText(getActivity().getApplicationContext(), Base64.encodeToString(md.digest(),
                    Base64.DEFAULT), Toast.LENGTH_LONG).show();
        }
    } catch (PackageManager.NameNotFoundException e) {

    } catch (NoSuchAlgorithmException e) {

    }

enter image description here

And i got this command from here for terminal which give me release key hash.

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
Torture answered 12/10, 2015 at 7:4 Comment(1)
GET_SIGNATURES is deprecatedLipolysis
I
0

Get SHA1 and convert it using this_link

To get SHA1

if your app is published and you are using Play Store signing key go to Release -> app signing and copy SHA1.

if using app production SHA1 go to gradle from the right side menu and type signingReport the run

enter image description here

Inconsistency answered 24/4, 2024 at 17:33 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.