next gitportal question ... When setting up the io...
# touchlab-tools
b
next gitportal question ... When setting up the ios app, How do you all setup java for use via Xcode's Run Script Build Phases? Currently, when I try to execute the gradle build via the Run script, it errors out saying that it can't local a Java Runtime. That makes sense, since if I add
echo $JAVA_HOME
to the run script, it's empty. That also kind of makes sense, since Xcode runs those scripts in a non-interactive shell. But then that begs the question ... how to set the JAVA_HOME environment variable in a way that the script can find it? The obvious answer is to just set it at the top of the script itself in Xcode. That certainly works, but it would require that every developer working on the project has the same java in the same location on their machine. Likewise, setting the jdk path in the kmp's gradle.properties would have the same problem. Has anyone else run into this, and perhaps found a decent way to do it?
k
I've recently run into issues when I open Xcode from the Apple bottom toolbar, I get an incorrect JVM version when building, but when I open from terminal, it's fine. Probably some misconfig.
In any case, I use SDKMAN. Directly setting up
JAVA_HOME
can be tough and Xcode gets its env vars in a funky way (in my experience).
So, when I'm building a KMP project, if I'm having Java issues from Xcode: • Close Xcode (the process, not just the project window) • From the root of the KMP project, run
open [whatever folder/file].xcproject
• Continue with what I was doing After that, Xcode seems to get what it needs.
b
interesting. I'll give that a shot