We had a similar problem with our multi-module project, building OK from command line or Android Studio, but not from Xcode. We were able to work around it by adding the following to build.gradle in our MOE module (I assume this tweaks the order the modules are evaluated):
project.afterEvaluate {
// Hack to work around errors relating to afterEvaluate
moeMainDebugIphoneosXcodeBuild.mustRunAfter noOp
moeMainDebugIphonesimulatorXcodeBuild.mustRunAfter noOp
moeMainReleaseIphoneosXcodeBuild.mustRunAfter noOp
moeMainReleaseIphonesimulatorXcodeBuild.mustRunAfter noOp
}
task noOp {
doLast {
println "NoOp"
}
}