I want to use facebook sdk. I have created an app in fb developers console, also created a hash key using
C:\Program Files (x86)\Java\jre1.8.0_131\bin>keytool -exportcert -alias androiddebugkey -keystore C:\Users\siddhi jambhale\.android\debug.keystore | "C:\Program Files (x86)\openssl-0.9.8k_X64\bin\openssl.exe" sha1 -binary | "C:\Program Files (x86)\openssl-0.9.8k_X64\bin\openssl.exe" base64
Illegal option: jambhale\.android\debug.keystore
keytool -exportcert [OPTION]...
Exports certificate
Options:
-rfc output in RFC style
-alias <alias> alias name of the entry to process
-file <filename> output file name
-keystore <keystore> keystore name
-storepass <arg> keystore password
-storetype <storetype> keystore type
-providername <providername> provider name
-providerclass <providerclass> provider class name
-providerarg <arg> provider argument
-providerpath <pathlist> provider classpath
-v verbose output
-protected password through protected mechanism
Use "keytool -help" for all available commands
2jmj7l5rSw0yVb/hgfgfr/YBwk=
Above its showing illegal option but got the key, tried to use this key but not working.
As showing illegal option I tried to cut down space between username ie siddhijambhale. And tried the key I got. But this is also not working.
C:\Program Files (x86)\Java\jre1.8.0_131\bin>keytool -exportcert -alias androiddebugkey -keystore C:\Users\siddhijambhale\.android\debug.keystore | "C:\Program Files (x86)\openssl-0.9.8k_X64\bin\openssl.exe" sha1 -binary | "C:\Program Files (x86)\openssl-0.9.8k_X64\bin\openssl.exe" base64
I get this error, and the key shown in the error is different than the key I have got from cmd and which is stored in the fb developers console.
What to do for this?
Please help. Thank you..
run this code in your one of activity...
try {
PackageInfo info = getPackageManager().getPackageInfo(
"YOUR_PACAKGE_NAME",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
it will give you keyHash and Add that keyhash in your Facebook A/C.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.