Hashkey mismatch android facebook app

╄→гoц情女王★ 提交于 2019-12-13 05:05:30

问题


Downloaded recent facebook android sdk 3.7 and i tried to run sample apps in the sdk. When I tried helloFacebookSample app i got hashkey problem. I searched through web and got my hashkey correct i.e DSygOIIJUkYyHy/duT1e72ZHl5U=.

My app is showing "hashkey not stored" error. When I logged my sample app hashkey I found strange thing happening.

I am using this code:

Toast.makeText(getApplicationContext(),Base64.encodeToString(md.digest(), Base64.DEFAULT), Toast.LENGTH_LONG).show();
                Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));

                Toast.makeText(getApplicationContext(),Base64.encodeToString(md.digest(), Base64.DEFAULT), Toast.LENGTH_LONG).show();

Same piece of code is showing different hashkeys

DSygOIIJUkYyHy/duT1e72ZHl5U=

2jmj7l5rSw0yVb/vlWAYkK/YBwk=

and when I try to post status it shows a different hashkey.

DSygOIIJUkYyHy_duT1e72ZHl5U=

I have stored all three hashkeys in my sample app, and it is still showing me this error.


回答1:


This problem usually comes when hashkey generated by your app doesnt match with the one which you have put in facebook developers site. Try to generate the hashkey programmatically and put it in developers site. Hope this solution helps




回答2:


The same problem occurred to me , i had no idea what gone wrong ,then i realized that that key store that i used to generate the key hash was a different one ,if you have signed your app you will get a .jks key store file ,you have to specify that path of the file in the code generating the key hash like

keytool -list -v -keystore yourkeystore_path/yourkeystore.jks -alias your_aliase_name 

the names of the keystore file and aliases name should be same as the one when you signed your app then your get the correct code for sure.

then there also a work around just write down the code displaying in the error and put it in the keyhash field simple as that...

hope it helps



来源:https://stackoverflow.com/questions/22321317/hashkey-mismatch-android-facebook-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!