linuxunity-game-enginefacebook-unity-sdk

Facebook SDK on Linux Unity Editor cant found Keytool


I working on Pop_OS 20.04 LTS with Unity 2019.4 LTS and I have problem, Facebook SDK cant found Keytool. In source code available on GitHub sdk trying to execute next command:

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

I can execute it from terminal or even from c# program using their code from sdk, but in unity this not working for some reason:

static void Main(string[] args)
    {
        var proc = new Process();
        var arguments = @"""keytool -storepass {0} -keypass {1} -exportcert -alias {2} -keystore {3} | openssl sha1 -binary | openssl base64""";
        proc.StartInfo.FileName = "bash";
        arguments = @"-c " + arguments;

        proc.StartInfo.Arguments = string.Format(arguments, "android", "android", "androiddebugkey", System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + @"/.android/debug.keystore");
        proc.StartInfo.UseShellExecute = false;
        proc.StartInfo.CreateNoWindow = true;
        proc.StartInfo.RedirectStandardOutput = true;
        proc.Start();
        var keyHash = new StringBuilder();
        while (!proc.HasExited)
        {
            keyHash.Append(proc.StandardOutput.ReadToEnd());
        }
        
        switch (proc.ExitCode)
        {
            case 255: Console.WriteLine("Error");
                return;
        }
        Console.WriteLine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + @"/.android/debug.keystore");
        Console.WriteLine(keyHash.ToString());
    }

. Can somebody help with this?


Solution

  • It looks like I can safely use the hash generated by this command.

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

    Although I get an error stating that Facebook is not configured,but it does not prevent me from building a workable application