Search Unity

Keytool not found - Facebook SDK on Android Native Plugin

Discussion in 'Android' started by Raistel, Apr 10, 2014.

  1. Raistel

    Raistel

    Joined:
    Feb 23, 2014
    Posts:
    2
    Hi everyone! I've been searching for hours and trying every method i found without any luck, so here we go:

    In my Facebook > Edit Settings window it shows the warning "Keytool not found". I've already set the variables JAVA_HOME (to my jdk folder) and PATH (adding the bin folder of JAVA_HOME, and the path of OpenSSL\bin).

    I also went to the FacebookAndroidUtil class to change the method DebugKeyStorePath, including the local drive at the start of the sentence like this:

    System.Environment.GetEnvironmentVariable("HOMEDRIVE") +
    System.Environment.GetEnvironmentVariable("HOMEPATH") + @"\.android\debug.keystore" :
    System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + @"/.android/debug.keystore";

    So now it points to the debug.keystore, but it seeems no progress was made. What have i missed?


    Also, i'm working on Win8 64bits, and my Java version seems to be the x86 one (1.6.0_45), could this be the problem?
     
    Last edited: Apr 10, 2014
  2. Raistel

    Raistel

    Joined:
    Feb 23, 2014
    Posts:
    2
    I just answered my own thing. Installing a x64 version of JDK and reassigning JAVA_HOME to that folder made the trick.
     
  3. Lawrence-Cheuk

    Lawrence-Cheuk

    Joined:
    Nov 28, 2012
    Posts:
    3
    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
     
  4. Soleferry

    Soleferry

    Joined:
    Nov 13, 2013
    Posts:
    4
    I don't know what you're trying to do Lawrence, but i've solved my problem, which was similare to Raistel by editing my variable JAVA_HOME to link to the /bin folder of the JDK i'm currently using.
     
  5. alex_roboto

    alex_roboto

    Joined:
    Nov 11, 2019
    Posts:
    26
    The JAVA_HOME will only work after you kill or exit all Unity processes, including Unity Hub, then restart Unity. Unity seems to hold onto the environment variables and doesn't pick them up until all Unity processes have been quit and restarted.