Androidstudio Gradle Proxy

AndroidStudio gradle proxy

In Android Studio -> Preferences -> Gradle, pass the proxy details as VM options.

Gradle VM Options
-Dhttp.proxyHost=www.somehost.org -Dhttp.proxyPort=8080 etc.

*In 0.8.6 Beta Gradle is under File->Settings (Ctrl+Alt+S, on Windows and Linux)

Android Studio Gradle proxy settings

If you want to use a proxy for a particular project, go to your project directory and locate “gradle.properties” file. It should be in the same directory as “build.gradle” file. If you don’t see one, create one. Make sure to create “gradle.properties” and not “gradle.properties.txt”.

Add your proxy info-

systemProp.http.proxyHost=some-proxy-host.com

systemProp.http.proxyPort=some-port

systemProp.https.proxyHost=some-proxy-host.com

systemProp.https.proxyPort= some-port

If you have authentication as well, add-

systemProp.http.proxyUser=userid

systemProp.http.proxyPassword=password

systemProp.https.proxyUser=userid

systemProp.https.proxyPassword=password

If you want all projects to have the same proxy setting-

Go to your user home directory. In Win 7, it would be “C:\Users\username”. Locate .gradle directory and drop “gradle.properties” file you created above in .gradle directory.

How to set proxy server for gradle?

Gradle has it's own dependency management system similar to maven. I think parts of the gradle publish plugin are backed by maven in some way (not verified). Regardless you shouldn't have to worry about that level of depth, gradle will handle it. Your problem is setting up the proxy. You just need to set some variables in $projectDir/gradle.properties, example:

#http proxy setup
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost

#https proxy setup
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost

reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy

Android studio on mac: remove proxy settings

I finally fixed my problem, if someone needs the solution:

My old proxy settings were stored in the file ~/.gradle/gradle.properties

gradle behind proxy in Android Studio 1.3

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

Error:Unknown host services.gradle.org. You may need to adjust the proxy settings in Gradle

Update your project level build.gradle to latest version - it works for me

classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'


Related Topics



Leave a reply



Submit