In my project, I am using facebook API for login purpose. I got key hash error , when ever i try different account or different mobile device. Any body known this type issue. How to solve this. In below, i attached error screenshot.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
public void generateHashkey(){
try {
PackageInfo info = getPackageManager().getPackageInfo(PACKAGE, PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String s = Base64.encodeToString(md.digest(),
Base64.NO_WRAP);
Log.e("HASH KEY ", s);
}
} catch (PackageManager.NameNotFoundException e) {
Log.d("Name not found", e.getMessage(), e);
} catch (NoSuchAlgorithmException e) {
Log.d("Error", e.getMessage(), e);
}
}
try to generate the hashkey then copy paste it to developer console facebook.