There must be some other ways to solve this error. But how i solved is simply adding this line of code in FacebookAndroidUtil.cs file
System.Environment.GetEnvironmentVariable("G:\android\android-sdks") + @"\.android\debug.keystore" :
The problem was i had %HOMEPATH% environment variable in other drive(In G:/) and unity project in another drive.
Then whenever Facebook SDK calls System.IO.File.Exists(DebugKeyStorePath), DebugKeyStorePath is actually wrong. That is because DebugKeyStorePath is searching in
System.Environment.GetEnvironmentVariable("HOMEPATH") + @"\.android\debug.keystore"
Which is wrong path to find the key.
Solution
Go to FacebookAndroidUtil.cs file, and on line 62 change the code fromSystem.Environment.GetEnvironmentVariable("HOMEPATH") + @"\.android\debug.keystore" :
To
System.Environment.GetEnvironmentVariable("G:\android\android-sdks") + System.Environment.GetEnvironmentVariable("G:\android\android-sdks") + @"\.android\debug.keystore" :
Change G:\android\android-sdks to you android sdk path.
Now its working fine and i got my keyhash in Facebook settings. I hope this will work for you too.
Any Problem? Feel free to say in comments.
The line 62 is:
ReplyDeletesetupError = ErrorNoKeystore;
But the line 98 contains what you writed.
Changing code, saving code, and closing then reopening Unity isn't solved my problem.
Where is the file?
ReplyDeleteC:\Users\username\.android
ReplyDelete