the task is called by the xcode toolchain so settings etc in Android Studio have no effect, it’s about what is the system default (which is a topic I won’t go into).
you could take the suggestion of setting the correct java home through gradle.properties however.