I remember a time when I thought Gradle was the bee’s knees: “no XML, config written in Groovy, how awesome.” Now, it’s the most frustrating part of Android development.

Got it working in the end by upgrading Java and the Android SDK, but golly it sapped a lot from me. Although, to be fair, I’m not how standard the Gradle build is for a typical Android project. I guess it’s better than when they were using Ant.
Anyway, kids: just use Maven. Work through the XML. It’s just a better build system.