gradle behind proxy in Android Studio 1.3
Asked Answered
B

2

16

I've just upgraded Android Studio to version built on 28 July 2015. And proxy settings stopped working.

I have them configured in AS preferences and in project's gradle.properties like this:

systemProp.http.proxyHost=some.proxy.adress.com
systemProp.http.proxyPort=3128

And yet gradle build fails suggesting I should configure the proxy in either graddle properties or IDE.

Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.

What else can I try?

P.S. Proxy works and is picked-up properly from Android Studio preferences, as git works as expected.

Bailes answered 4/8, 2015 at 7:52 Comment(0)
D
32

Perhaps you also need to configure the https settings

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
Denadenae answered 4/8, 2015 at 13:23 Comment(6)
A project specific file that is checked into GIT is not the proper place for personal proxy settings, especially not for my userid and password. But even the proxy host and port will be different depending on what machine I'm working on. What is the correct solution? Where do I place them IDE specific, not project specific?Bikales
You can have a gradle.properties file outside the project in your gradle user home directory (defined by the GRADLE_USER_HOME environment variable). You can also pass properties on the command line via -Dprop=value. More info hereDenadenae
Could you maybe add that into your answer/solution? That should be the preferred place for those settings. Only in exotic cases, you want to have your proxy settings to be checked in with your project files.Bikales
Along with http proxy, add https proxy details also. In my network the parameters for both protocols are same. If I give only http, it is not working. I copied all the lines and made it to https, it worked.Butene
How can we pass proxyUser and password by argument ? i dont want to user globle gradle.propaerties file.Lallans
@Denadenae How can we pass proxyUser and password by argument ? i dont want to use globle gradle.propaerties file.Lallans
F
12

After finding an answer for days...

As Lance said, you need to set in the gradle.properties settings for https (I write details here for further visitors)

systemProp.https.proxyHost=some.proxy.adress.com
systemProp.https.proxyPort=3128

At the end, your gradle.properties file (on the root of the project) will be :

systemProp.http.proxyHost=some.proxy.adress.com
systemProp.http.proxyPort=3128
systemProp.https.proxyHost=some.proxy.adress.com
systemProp.https.proxyPort=3128
Fabiola answered 7/8, 2015 at 12:57 Comment(4)
adding the same proxy host and port for https solved my problem, thanksCopeland
This helped! https.proxyPort wasn't supported though just https.proxyHost was.Gibun
You saved my day. ;)Cort
How can we pass proxyUser and password by argument ? i dont want to user globle gradle.propaerties file.Lallans

© 2022 - 2024 — McMap. All rights reserved.