# multiplatform

Rodrigo Munera

10/09/2023, 3:43 PM
I'm having a really weird issue in my local environment. I've previously set up my java installation using asdf (for other work-related requirements). And creating a new KMP project and launching the iosApp from the template I get the following error:
ERROR: JAVA_HOME is set to an invalid directory: /Users/<myuseraccount>/.asdf/shims/java
even though I've removed
(using homebrew) and removed the folder from my laptop. Also modified .bash_profile, .zshenv and .zshrc files. also
which java
java --version
return the manually installed java 17. This error happens when launching the iosApp from android studio or by opening the generated project in xcode and attempting to build the project. This error does not happen if I try to create a new project in xcode so I suspect it has something to do with how the KMP template is scaffolding the new project. Has anybody ran into this issue before? My guess is that the Android Studio is storing that old java_home path somewhere hardcoded and it won't update even if the java paths have changed under the hood
OMG! I've been trying to figure this out for the past week and I just decided, on a whim to run
kdoctor -v
And I got my answer there. There was a custom path in xcode
Xcode -> Settings -> Locations -> Custom Paths
with the asdf path for
and that's what was causing all my troubles. I'll document my solution below in case anybody runs into this issue: 1. Removed the custom JAVA_HOME path from xcode, 2. In android studio I cleared the builds in
Build -> Clean Project
3. In android studio I rebuilt the project in
Build -> Rebuild Project
4. In xcode i cleared the build folder in
Product -> Clean Build Folder...
5. In xcode i rebuilt the project with
Command + B
I was then able to run the iosApp from both apps using
👍 2