Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Juice118 · Nov 11, 2013 at 03:34 PM · facebookunity-android

Debug Android Hash Key - Facebook SDK

NOTE for 5/2014 ...

the only real solution to this problem is the "Rafael solution" here:

http://answers.unity3d.com/questions/609810/using-facebook-api-with-android-says-login-is-canc.html

it's also the ONLY solution if you're on Mac. Hope it helps


Hey Guys,

I am having difficulty in getting the FriendSmash example to login on an android device and I believe it has to do with my inability to get unity to recognise the Debug Android Hash Key for the Facebook SDK.

I am using Unity 4.2.2, Facebook Unity SDK 4.3.4, JDK1.7.0_04, Android SDK 22.3 and have OpenSSL.exe (0.9.8h-1) located in the bin directory of the JDK.

However the Debug Android Hash Key under Facebook>Edit Settings is blank. According to this Unity attempts to run:

 keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64

If I enter this as is into cmd when in the JDK/bin directory (where the keytool is - by the way, how does unity know to go to this directory?) then it asks for a password and gives me the key which I have entered into the fb developer app page. However Unity still does not recognise this in Facebook>Edit Settings and this remains blank.

I am sure I have set everything else up right (in terms of bundle identifiers, app id etc) and that this must be my problem, the only other things I can think of is that FB.GetAuthResponse does not exist in the project which I replaced with FB.Login. The app builds and runs fine on my device - I just cannot login to facebook.

I have seen a few others experience difficulty, however the fixes have not worked.

Any Ideas.

Thanks,

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gajdot · Nov 14, 2013 at 01:48 PM 0
Share

Did you found a way around it? Because I'm experiencing the same problem.

avatar image Juice118 · Nov 15, 2013 at 06:48 AM 0
Share

Hey gajdot - the answer is.. kind of. I have not managed to get Unity to recognize the hash key. However I just loaded the app up again then after reading your comment and it is working!? For your sake all I have done is run the above keytool command copied the key into facebook app (also ensuring app id and bundle id are right) and that's it. Now I have not done anything since posting this question and it did not work then I swear it - and Unity still has the blank line at hash key so guessing its not a requirement. Happy to try help further but I really don't know why it wasn't working a few days ago and is now. Have left question unanswered as still unsure why Unity will not recognize the key.

avatar image MichiealO · Nov 29, 2013 at 07:25 AM 0
Share

I've not gotten the hash key to show up either. I'm using Unity 4.3 & FB SD$$anonymous$$ 4.3.4... I was able to get the hash key out of the keystore using the keytool application. Thus far, my droid app is not connecting to Facebook :( fully, but I am hoping that is an issue on my side and not a hash key issue. If anyone has anything to add to this, it would be greatly appreciated. FYI - to publish your application onto Google Play, you cannot use a debug key... at all.

avatar image gajdot · Nov 29, 2013 at 07:37 AM 0
Share

Well i had to revert to 4.2.2 unity project and there it works fine(the hash key won't show up, but at least when I generate it, it will accept it) and I can connect to Facebook.

5 Replies

· Add your reply
  • Sort: 
avatar image
14
Best Answer

Answer by hamstar · Mar 03, 2014 at 09:15 AM

Here's instructions for @allesisda and anyone else who might be having trouble with this on Windows. @Michieal's instructions are correct, but I found them a bit hard to understand.

Download and install OpenSSL.

  • http://slproweb.com/products/Win32OpenSSL.html

  • Win32 OpenSSL v#.#.# (not Light)

  • OR Win64 OpenSSL v#.#.# (not Light)

Add the OpenSSL directory to your path.

  • Go to: Control Panel > System > Advanced system settings > Environment Variables

  • Select the Variable "Path" in the "System variables" window and click Edit.

  • Add the path to your OpenSSL bin folder to the end of the "Variable value" text. e.g. I added ;C:\Program Files\OpenSSL-Win64\bin to the end of the value text.

Restart Unity3D.

If you get the error in FacebookSettings "Keytool not found", you need to add the JDK (Java Development Kit) bin directory to the Path variable value.

  • Follow the same steps as before, but instead of the OpenSSL bin path, add the JDK bin path. e.g. I added ;C:\Program Files\Java\jdk1.7.0_45\bin to the end of the value text.

Comment
Add comment · Show 15 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hamstar · Mar 03, 2014 at 01:34 PM 0
Share

p.s. I also found that to build I had to have both versions of JD$$anonymous$$ installed (32 & 64bit).

avatar image Codest19 · Mar 05, 2014 at 04:29 AM 1
Share

Thank you so much, solved my problem in no time!

avatar image KrlinM · Apr 09, 2014 at 07:03 PM 1
Share

Love you Hamstar, you make my day! I spend 3 days with this problem and now thanks to you its finally working. And sorry for my english.

avatar image Mustafa Adil · Apr 19, 2014 at 07:31 AM 0
Share

i've done this but again the error "$$anonymous$$eytool not found" is showing. What am i doing wrong? can someone please guide me

avatar image StaticNova · May 19, 2014 at 01:51 AM 0
Share

If you have the 32 bit version of the JD$$anonymous$$ installed your path is "C:\Program Files (x86)\Java\jdk1.7.0_45\bin\".

Show more comments
avatar image
2

Answer by muhammadtahiriqbal · Jan 11, 2018 at 06:15 AM

I used following steps to generate a Key Hash for my app in facebook: (I am using Mac OSX 10.12.6

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

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

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

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by MichiealO · Nov 29, 2013 at 07:57 AM

https://developers.facebook.com/docs/unity/downloads/?campaign_id=282184128580929&placement=SDK_list Has the newest version of the Facebook SDK. If you don't already have the OpenSSL files, download it and install it in (copy it into) your path. With 4.3.6 of the SDK it automatically tells you that it is missing (if it is) and will create the Hash for you. I did it the hard way (above) to get the hash key, and I was still having login issues, so I went and checked, downloaded the 4.3.6 version of the SDK (I'm using Unity 4.3.0f) and added the directory (openssl\bin) to my path (in the environment variables in the Windows Computer Properties->Advanced System Setting->Environment Variables) and viola! it did it automatically and shows the Hash Key, just like the video says it should! :D

Good luck & Happy Coding!!

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image allesisda · Jan 21, 2014 at 12:03 AM 0
Share

copy it into wich path? the unity asset folder? should the properties->Advanced System Setting->Environment Variables be in unity?

avatar image allesisda · Jan 21, 2014 at 12:11 AM 0
Share

and where am i supposed to type in the "keytool command?" cmd says that keytool is a unknown command -.-

avatar image MichiealO · Sep 26, 2020 at 04:37 AM 0
Share

@allesisda the path that you put it into is your computer's PATH variable. Then, you open up a command prompt and type things in there. Sorry for the length of time on my response... I honestly had forgotten all about this answer... >.>

avatar image
0

Answer by JigneshKoradiya · Aug 02, 2015 at 04:55 PM

https://youtu.be/VD9UfjnPF-I

this video will help you to solve your question

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Zewde · Dec 20, 2015 at 11:20 AM

This happens often when you update your Java and the folder name changes, meaning your PATH Enviorment variable is directing towards a folder which doesn't exist (anymore). Update your path.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

32 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity Facebook SDK - Android Deployement - Key Hash ? 9 Answers

How can i make Android Textures rendered better? 1 Answer

Color Correction Effect on Android, Unity 4.3 1 Answer

[EGL] Failed to create surface :: GfxDevice is in invalid state 0 Answers

Permissions not being granted with Facebook App installed 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges