Should you use Robolectric with Gradle for your Android builds, you may find your tests failing when the first test using the RobolectricTestRunner is attempted to be used if you sit behind a strict firewall or proxy.

My current client has these policies in addition to its own Nexus repository that proxies most other public repositories such as OSS and repo1. We configured our Gradle scripts to leverage this repository:

buildscript {
 repositories {
 maven {
 url ""

Doing simple gradlew clean assemble worked fine, but when I tried gradlew test, all tests that weren't using the RobolectricTestRunner passed but the RobolectricTestRunner tests failed. I was receiving an odd error of Robolectric being unable to obtain artifacts from or from, which wasn't honoring my Gradle repository configuration. Upon inspecting Robolectric's source code, I realized that it is using Maven Ant Tasks under the covers to download some needed dependencies. To get around this issue, you'll need to provide a $HOME/.m2/settings.xml file that leverages the internal repository or to configure proxying, even when you aren't using Maven.