Reputation: 431
I'm trying to compile an Android project behind a proxy. Most of my dependencies compile fine, but when I add Robolectric to my build.gradle class path I always get errors. So my first proxy configuration is done in Preferences -> HTTP Proxy
. When I try to compile with just these settings I get a 407 response:
Error:Could not HEAD 'http://repo1.maven.org/maven2/org/robolectric/robolectric-gradle-plugin/0.12.0/robolectric-gradle-plugin-0.12.0.jar'. Received status code 407 from server: AuthorizedOnly
Which doesn't really make sense because I provide my credentials in the HTTP Proxy
settings. Additionally, I try the test-url function on the HTTP Proxy
page and it says connection successful.
So then I try adding settings in the gradle.properties file. Which then gives me the following 500 error:
Error:Could not HEAD 'http://repo1.maven.org/maven2/org/robolectric/robolectric-gradle-plugin/0.12.0/robolectric-gradle-plugin-0.12.0.jar'. Received status code 500 from server: ruleengineerror
Are there any settings I'm forgetting? Why are my other dependencies from mavenCentral able to compile? I freshly imported this product so I didn't begin with a cache and if I take the Robolectric out it compiles fine.
Any help would be appreciated. If this is too localized I apologize in advance.
Upvotes: 1
Views: 2626
Reputation: 431
To anyone who is having trouble with this I finally found a solution that let's me smoothly download all my dependencies behind a proxy.
I'm trying to work behind an NTLM proxy which for me did not cooperate nicely with Gradle. In order to get around this I downloaded SquidMan and set it up. Like some others have suggested in other posts I'm setting up an intermediary proxy to forward my requests and enter my credentials to the main proxy.
Setup:
Gradle should now be able to smoothly download dependencies behind the proxy.
Hope this helps someone!
Upvotes: 1
Reputation: 141
Robolectric leverages Maven configurations for it's dependency resolution (super weird). Take a look at this blog post I wrote for the answer.
Robolectric and Gradle behind Proxies and Firewalls
Just to further this a bit, you'll need to configure your .m2/settings.xml with your proxy information.
Upvotes: 0