facebook 연동시 keytool not found 뜰때.
facebook sdk for unity 6.0 got very minor bug
They detect if u have keytool using following function in FacebookAndroidUtil.cs
private static bool DoesCommandExist(string command)
{
var proc = new Process();
if (Application.platform == RuntimePlatform.WindowsEditor)
{
proc.StartInfo.FileName = "cmd";
proc.StartInfo.Arguments = @"/C" + command;
}
else
{
proc.StartInfo.FileName = "bash";
proc.StartInfo.Arguments = @"-c " + command;
}
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.CreateNoWindow = false;
proc.Start();
proc.WaitForExit();
if (Application.platform == RuntimePlatform.WindowsEditor)
{
return (proc.ExitCode == 0);
}
else
{
return proc.ExitCode != 127;
}
}
If you open a command prompt and type keytool, it show up all the parameter that you can use for the command keytool.
It will not exit with exitCode 0 but 1 which means partially success as no parameter is provided for keytool. so the check for if you have keytool always failed.
Actually you can turn on shell by change proc.StartInfo.UseShellExecute = false; to true and you can see the parameter hint come out for the command keytool , which means keytool is there. it just the DoesCommanExist have a bug.
The fix is change
return (proc.ExitCode == 0);
to
return (proc.ExitCode == 0||proc.ExitCode == 1);
I know nothing about cmd but this page tell me, exitcode 1 mean partially succeed.
http://msdn.microsoft.com/en-us/library/ms194959(v=vs.100).aspx
출처 - http://forum.unity3d.com/threads/keytool-not-found-facebook-sdk-on-android-native-plugin.239696/