- Home /
Unity Facebook SDK - Android Deployement - Key Hash ?
Hi everyone, hope I m not in the wrong spot of the forum for this thread ! Any ways, I got an issue to set up the latest version of the Unity Facebook SDK released, the 4.2.1 (build version 130912.80d74183e6e5bd9)
The problem that I m blocked at the app config step, following the documentation on facebook developer pages, it says that the SDK should be printing up the Key Hash for my app so I just have to copy / paste it the the facebook app config edition. But actually the Facebook Settings tool in Unity doesn't show up any key hash (nothing appears in front of Debug Android Key Hash), the app name and app ID are there, as much as the package and class name !
I have a feeling that I m missing something stupid out there but after 3 hours trying to find any hint somewhere, ... I m just stuck.
Any help please ?
The only real solution:
http://answers.unity3d.com/questions/609810/using-facebook-api-with-android-says-login-is-canc.html
fortunately very simple. the only solution if you're on $$anonymous$$ac.
Answer by Caieu · Oct 03, 2013 at 02:37 AM
I had the same problem and did the following:
I downloaded the Openssl here, extract the archive, put the content of bin folder in C:\Program Files\Java\jdk1.7.0_06\bin
(or your Java SDK Folder) and execute the following command in cmd:
keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | C:\Program Files\Java\jdk1.7.0_06\bin\openssl.exe sha1 -binary | C:\Program Files\Java\jdk1.7.0_06\bin\openssl.exe base64
You need to enter password, is android.
After that, i reopenned the Facebook Editor settings and the Debug Hash Key appears.
Thank you for your answer that was very helpful and it did actually resolve my problem :) but I have to fix something you are missing out there, the " " in the paths :)
keytool -exportcert -alias androiddebugkey -keystore %HO$$anonymous$$EPATH%\.android\\debug.keystore | "C:\\Program Files\\Java\\jdk1.7.0_06\\bin\\openssl.exe" sha1 -binary | "C:\\Program Files\\Java\\jdk1.7.0_06\\bin\\openssl.exe" base64
Of course please think about replacing : **C:\\Program Files\\Java\\jdk1.7.0_06\** with you local JD$$anonymous$$ installation folder path
Important To know also, the right version of openssl tu use on windows 7 x64 with JD$$anonymous$$ version jdk1.7.0_40 is the version 0.9.8h-1 that you can download in zip format right here
It works like charm! Wohooo! Thanks alot Da$$anonymous$$ex & Caieu :)
hello, I used the same way to create Hash key, but Debug Hash $$anonymous$$ey didn't appear in Facebook Editor settings. Can you help me? thanks.
I tried it, but still nothing... it finishes and all, but it just won't appear.
Answer by Ziamark · Feb 16, 2014 at 05:10 AM
If anyone is wondering how to add the "system variables" on a windows 7 system.
Computer > System Properties > Advanced System Settings > (you should be on the advanced tab of the system properties window now) Environment Variables:
From here double click the "Path" variable in the system variables list and add your paths to the end of the "variable values" separated with a semi-colon like so:
... ;C:\OpenSSL\bin;C:\Program Files\Java\jdk1.7.0_51\bin
Hope it helps
Oh, goodness. After googling for an answer for almost 2 hours now, your comment saved the day. Everyone else has left this vital information out. I was adding a new "Environment Variable" as opposed to adding to an the "Path" variable. Thank you so much.
Thanks so much, this info about adding the environment variables was the missing piece of the puzzle for me.
Answer by ammoro · Feb 05, 2014 at 03:11 PM
Actually, the following solution is too much easier than all the other ones:
Just download OpenSSL, extract its content to (e.g. C:\OpenSSL) (for 64 bit machine, ownload openssl-0.9.8e X64)
Add both the bin directories of OpenSSL and Java JDK to the system variables and Unity/FacebookSDK will do all the work for you and you will get the Android key Hash!!
Simple, no? :-)
Thank ammoro, that was easy. The bin is the key word here I missed.
Answer by PerfectlyInsane · Apr 20, 2014 at 05:11 AM
This took me 3 hours to work out, even after reading heaps of post of how to get it to work. First of all download openSSL at the time of writing you should be getting v1.01g or higher. Extract the files and move the contents of the bin folder to the bin folder of your java installation.
Set up the environmental of Path to
"C:\\Windows\\System32;E:\\Program Files\\Java\\jdk1.7.0_45\\bin" (Make sure there are no extra spaces)
You need to put system32 into the Path as you have choosen to place files there during OpenSSL installation.
Now go to command prompt to see if the paths have been done correctly the following should work/still work.
type "Keytool" then type "OpenSSL"
Now exit command prompt
If you have executed an android eclipse project you should now have a dubug key file located @ C:\\Users\[UserName]\.android called "debug.keystore"
Also make sure that unity project is in the same folder as the debug keystore or make changes to the facebook api as mentioned by other post. You might be able to create a fake folder to hold the debug keystore file, if you are unable to move to project to the keystore location.
Thanks, that helped alot, if anyone want the final command it would be keytool -exportcert -alias androiddebugkey -keystore "c:users\your user name.android\debug.keystore" | openssl sha1 -binary | openssl base64
the double " " around the path is important if you have spaces in of the file names (if your user name is "user 1" for example)
Answer by SATISHKUMAR-GHINAIYA · Nov 29, 2014 at 09:08 AM
I have same problem.after spending 2 days i got this solution.
If you using facebook unity plugin than go to"Assets->Facebook->Editor->android" and open FacebookAndroidUtil.cs.
In above script just replace line number 70 with below line "var arguments = @"""keytool -storepass {0} -keypass {1} -exportcert -alias {2} -keystore {3} | openssl md5 -binary | openssl base64""";"
this is work fine for me.
Your answer
Follow this Question
Related Questions
Debug Android Hash Key - Facebook SDK 5 Answers
Touch: works on Unity-Remote, doesn't work on Android device after building 2 Answers
KeyNotFoundException: The given key was not present in the dictionary. 1 Answer
How to extend Activity (Android)? 1 Answer
Permissions not being granted with Facebook App installed 0 Answers