I've tried to run AndroidStudio
But It's failing on boot with gradle
error:
Failed to import Gradle project: Connection timed out: connect
I found solution here
But I can't find how to set this properties in Android Studio
.
Setting them in graddle-wrapper.properties
doesn't help.
This question is related to
android
gradle
android-studio
If build failed due to gradle proxy setting then simply putting my proxy IP address and port number will solve. It worked for me. File -> setting -> http proxy -> manual configuration -> Host name: your proxy IP, port number: your proxy port number.
Rajesh's suggestion did not work for me. What I did was go to
File -> Settings ->HTTP Proxy(Under IDE Settings) ->Manual proxy configuration
I still left the proxy information in Project Settings under Gradle, like Rajesh suggested. But I'm not entirely sure if it's necessary.
I am using 0.8.6 Beta
For the new android studio 1.2 you find the gradle vm args under:
File
- Settings
- Build, Execution, Deployment
- Build Tools
- Gradle
In my case I am behind a proxy with dynamic settings.
I had to download the settings script by picking the script address from internet settings at
Chrome > Settings > Show Advanced Settings > Change proxy Settings > Internet Properties > Connections > LAN Settings > Use automatic configuration script > Address
Opening this URL in a browser downloads a PAC file which I opened in a text editor
PROXY
string, it should contain a hostname and portgradle.properties
systemProp.https.proxyHost=blabla.domain.com
systemProp.https.proxyPort=8081
Go to gradle.properties
file (project root directory) and add these options.
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=user
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=localhost
systemProp.http.auth.ntlm.domain=domain
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=user
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=localhost
systemProp.https.auth.ntlm.domain=domain
For Android Studio 3.2(Windows),you can edit the gradle.properties
file under C:/Users/USERNAME/.gradle
for current user.
The following works for me . File -> Settings -> Appearance & Behavior -> System Settings -> HTTP Proxy Put in your proxy setting in Manual proxy configuration
Restart android studio, a prompt pops up and asks you to add the proxy setting to gradle, click yes.
For an NTLM Authentication Proxy:
File -> Settings -> Project Settings -> Gradle -> Global Gradle Settings -> Gradle VM Options
-Dhttp.proxyHost=myProxyAddr -Dhttp.proxyPort=myProxyPort -Dhttp.proxyUser=myUsername -Dhttp.proxyPassword=myPasswd -Dhttp.auth.ntlm.domain=myDomainName
For Android Studio 1.4, I had to do the following ...
In the project explorer window, open the "Gradle Scripts" folder.
Edit the gradle.properties file.
Append the following to the bottom, replacing the below values with your own where appropriate ...
systemProp.http.proxyHost=?.?.?.?
systemProp.http.proxyPort=8080
# Next line in form DOMAIN/USERNAME for NTLM or just USERNAME for non-NTLM
systemProp.http.proxyUser=DOMAIN/USERNAME
systemProp.http.proxyPassword=PASSWORD
systemProp.http.nonProxyHosts=localhost
# Next line is required for NTLM auth only
systemProp.http.auth.ntlm.domain=DOMAIN
systemProp.https.proxyHost=?.?.?.?
systemProp.https.proxyPort=8080
# Next line in form DOMAIN/USERNAME for NTLM or just USERNAME for non-NTLM
systemProp.https.proxyUser=DOMAIN/USERNAME
systemProp.https.proxyPassword=PASSWORD
systemProp.https.nonProxyHosts=localhost
# Next line is required for NTLM auth only
systemProp.https.auth.ntlm.domain=DOMAIN
Details of what gradle properties you can set are here... https://docs.gradle.org/current/userguide/userguide_single.html#sec%3aaccessing_the_web_via_a_proxy
If you are at the office and behind the company proxy, try to imports all company proxy cacert into jre\lib\security
because gradle uses jre's certificates.
Plus, config your gradle.properties. It should work
More details go to that thread: https://groups.google.com/forum/#!msg/adt-dev/kdP2iNgcQFM/BDY7H0os18oJ
in gradle.properties file (project root directory)
You must set proxy for http and https
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=user
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=localhost
systemProp.http.auth.ntlm.domain=domain
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=user
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=localhost
systemProp.https.auth.ntlm.domain=domain
if you set proxy from File -> Settings ->HTTP Proxy(Under IDE Settings) it only define http proxy and does not set https proxy
Source: Stackoverflow.com