转自:http://www.dotblogs.com.tw/newmonkey48/archive/2014/04/17/144779.aspx

App要使用Facebook 分享時,設要在Facebook應用程式裡設定app 的key hash

但keyhash要怎麼取得呢?

可參考兩個網址

http://blog.changyy.org/2011/05/android-facebook-sdk.html

http://blog.rx836.tw/blog/android-facebook-key-hashes/

需下載 openssl

http://blog.rx836.tw/blog/android-facebook-key-hashes/

下載後,解壓縮,如下,到bin資料下底下取得openssl.exe

C:\Users\Tom\Downloads\openssl-0.9.8h-1-bin\bin

放至Java目錄下,如下

C:\Program Files\Java\jdk1.6.0_23\bin

並從eclipse取得keystore放置位置

[Windpw] -> [Preferences] -> [Android] -> [Build]  的 Default debug keystore

我這邊取得的是

C:\Users\Tom\.android\debug.keystore

再來是使用Java bin底下的keytool,取得keyhash

打如下的指令

keytool -exportcert -alias androiddebugkey -keystore C:\Users\Tom\.android\debug.keystore | openssl sha1 -binary | openssl base64

會顯示以下,並輸入預設密碼android

輸入keystore 密碼:android

就會取得keyhash

再到facebook ->管理應用程式 ->自己的應用程式-> 設定 ,key hash 填入該keyhash即可。

debug.keystore的預設資料如下

Keystore name: "debug.keystore"
Keystore password: "android"
Key alias: "androiddebugkey"
Key password: "android"
CN: "CN=Android Debug,O=Android,C=US"

 
所以密碼才填android
 

注意:

打不到的alias及密碼,都會影響keyhash的產生結果,必須與當時的alias及密碼相同。

// mac平台

  1. First open a terminal (open a command prompt in windows).
  2. Navigate in the terminal to the directory where your Android debug.keystore is stored.
  3. Mostly it will located under “/Users/user_name/.android/” (In Windows will be C:\Documents and Settings\.android).
  4. Once you are in the “.android” directory, run the following command.

    keytool -exportcert -alias androiddebugkey -keystore debug.keystore | openssl sha1 -binary | openssl base64

  5. When it prompts you for a password, type android and hit Enter

  6. Copy the value printed in the terminal that ends with an “=” and paste it in the Key Hash field in Facebook. Then click the Save Changes button.

最新文章

  1. 如何用C#+WinRAR 实现压缩 分类:
  2. bootstrap笔记
  3. Android SDK代理服务器解决国内Android SDK不能更新下载问题
  4. Viking Village维京村落demo中的地面积水效果
  5. laravel框架总结(四) -- 服务容器
  6. 关于DPM(Deformable Part Model)算法中模型结构的解释
  7. 读论文系列:Nearest Keyword Search in XML Documents中使用的数据结构(CT、ECT)
  8. 高焕堂《android从程序员到架构师之路》 YY讲坛直面大师学习架构设计
  9. 视频编辑类sdk--lansoeditor--更新啦, 完全免费,欢迎下载
  10. Linux - tomcat -jndi数据源配置
  11. 2017Unity开发者大会备受关注的原因有哪些?
  12. android视频播放器系列(一)——系统播放器
  13. IDEA jsp模板
  14. web多语言url的设计
  15. spring mvc 映射与适配器
  16. DAY7 字符编码和文件操作
  17. confirm消息对话框
  18. 关于spire wb.SaveToPdf(f_pdf) excell 转为pdf 乱码问题
  19. Greenplum-cc-web安装
  20. JavaScript循环练习

热门文章

  1. 看来ms sql server if 中定义个变量出了if 还是可以用的
  2. php curl简单使用
  3. ScrollView中嵌套ListView
  4. 坑爹的gltools编译错误解决
  5. 常用SQL整理
  6. C# int.Parse()、int.TryParse()与Convert.ToInt32()的区别
  7. enum 使用
  8. linux中的配置文件
  9. 数据结构 -- 图的最短路径 Java版
  10. openstack kilo 流量