I'm working on an Android app, in which I want to integrate a Facebook posting feature. I downloaded the Facebook-Android SDK, and I got the readme.md (text file) in there, in which it is mentioned to generate the key hash for Android. How do I generate it?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
The instructions currently in Facebook's Android Tutorial do not work well under Windows. Their example shows how to pipe the keytool output to openssl but if you try this under Windows the output is not valid for some reason. I found that I had to use intermediary files to get it to work properly. Here are the steps that worked for me:
Start by downloading openssl for Windows from Google.
After running these commands the valid hash is stored in the file base64.txt. Copy and paste this to your app settings on Facebook.
To get the Android key hash code, follow these steps:
cd C:\Program Files\Java\jdk1.6.0_26\bin
keytool -export -alias myAlias -keystore C:\Users\
your user name\.android\myKeyStore | C:\openssl-0.9.8k_WIN32\bin\openssl sha1 -binary | C:\openssl-0.9.8k_WIN32\bin\openssl enc -a -e
As answered on a similar issue i found this to be working for me:
apkname.apk
file you want to know the hash of to the 'Java\jdk1.7.0_79\bin' folderkeytool -list -printcert -jarfile apkname.apk
SHA1
value and convert it using this siteHere are the steps-
Download openssl from Google code (If you have a 64 bit machine you must download openssl-0.9.8e X64 not the latest version)
Extract it. create a folder- OpenSSL in C:/ and copy the extracted code here.
detect debug.keystore file path. If u didn't find, then do a search in C:/ and use the Path in the command in next step.
detect your keytool.exe path and go to that dir/ in command prompt and run this command in 1 line-
For more info visit here
The simplest solution I have found is this:
Look for the line in the log that looks like this:
Copy "abcdefgHIJKLMN+OPqrstuvwzyz" and paste it into the Facebook Android Key Hash area.
Simply Open you Main Activity File and create below mention function:
1.1 Run you Application, this will generate a Hash key for your application.
Now, Open log cat and search with "KeyHash" and copy the hash key.
One you generate the Hash key you can remove this function.