Building a sub-project of a Gradle build, where another sub-project is Android

I have a Gradle project with three sub-projects: an Android sub-project, a “core” sub-project and a non-Android sub-project.

Both the Android and non-Android projects depend on the Core project.

I would like to make the non-Android project buildable without having Android development tools installed on the machine. However this is currently not possible for me, because the Android SDK’s presence is required for the configuration phase. I get this error:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':android'.
> failed to find target android-21 : /

How can I set up my project so that the non-Android component can be built without having these SDKs installed?

I believe this is effectively the same question being asked here: