如何分配"发展重点哈希"为一个设备,而不是一个仿真器 [英] How to assign "Development Key Hash" for a device and not an emulator

查看:127
本文介绍了如何分配"发展重点哈希"为一个设备,而不是一个仿真器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

登录与Facebook
我怎么可以指定一个发展的关键散列到Android设备?

login with Facebook how can I assign a "Development Key Hash" to a android device?

keytool -importkeystore -srckeystore path/to/keystore/with/forgotten/pw -destkeystore path/to/my/new/keystore

我只签使用模拟器,而不是设备的应用程序
我该如何解决?

I sign only the application using the emulator and not device how can I fix it?

推荐答案

您可以拿到钥匙哈希在这个片段中该设备,只需添加code在MainActivity并检查logcat的。

You can get the key hash for that device with this snippet, just add the code in your MainActivity and check the Logcat.

try {
    PackageInfo info = getPackageManager().getPackageInfo(
            "com.facebook.samples.hellofacebook", 
            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) {

}

BR

这篇关于如何分配"发展重点哈希"为一个设备,而不是一个仿真器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆