Rodrigo Munera
10/09/2023, 3:43 PMERROR: JAVA_HOME is set to an invalid directory: /Users/<myuseraccount>/.asdf/shims/java
even though I've removed asdf
(using homebrew) and removed the folder from my laptop. Also modified .bash_profile, .zshenv and .zshrc files. also which java
, java --version
and echo $JAVA_HOME
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 hoodkdoctor -v
And I got my answer there. There was a custom path in xcode Xcode -> Settings -> Locations -> Custom Paths
with the asdf path for JAVA_HOME
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