您可以在下面查看此链接以获取分步教程
如何获取 android-facebook 应用程序的密钥哈希
如果你仍然有同样的问题,那么你可以使用下面的代码片段来生成 keyhash。这对我来说非常好。
PackageInfo packageInfo;
try {
packageInfo = getPackageManager().getPackageInfo("com.yourapp",
PackageManager.GET_SIGNATURES);
for (Signature signature : packageInfo.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String key = new String(Base64.encode(md.digest(), 0));
// String key = new String(Base64.encodeBytes(md.digest()));
Log.e("Hash key", key);
}
}
catch (NameNotFoundException e1) {
Log.e("Name not found", e1.toString());
}
catch (NoSuchAlgorithmException e) {
Log.e("No such an algorithm", e.toString());
}
catch (Exception e){
Log.e("Exception", e.toString());
}