After updating to AGP, Xcode is failing to build m...
# multiplatform
s
After updating to AGP, Xcode is failing to build my project because gradle is unable to read
JAVA_HOME
variable. It seems like Xcode doesn’t source any shell profile during its build process causing
JAVA_HOME
to resolve to
null
. I checked this by adding this to my `build.gradle`:
Copy code
println("JAVA_HOME = ${System.getenv("JAVA_HOME")}")
Folks who’re using AGP 7.0, have any of you run into this before?
s
I wish there was a way to pickup user shell instead of having to define variables for xcode separately. Btw, is there any advantage of creating an
environment.plist
over setting
org.gradle.java.home
in
~/.gradle/ gradle.propeties
?
👋 1
m
I think both work.
I use gradle for a lot of different projects so I don't like putting too many things in my
~/.gradle/gradle.properties
but both should work
Since that
environment.plist
thingie seems capable of running arbitrary commands, it should be possible (albeit certainly not fun...) to define
JAVA_HOME
in a separate file that is sourced both from
.bash_profile
and
environment.plpist
s
good point that that would work with all apps and not just gradlew