I'm running into issues building android projects on a server in a corporate network behind a proxy on Jenkins. Have tried with both the jenkins gradle, as well as gradlew. Below is the error message after turning on debug mode.
17:12:31 17:12:40.482 [INFO] [com.android.build.gradle.internal.DependencyManager] Parsing /opt/android/tools/package.xml
17:12:32 17:12:42.383 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running
17:12:42 17:12:52.384 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
17:12:42 17:12:52.384 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
17:12:42 17:12:52.384 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
17:12:46 17:12:55.512 [WARN] [com.android.build.gradle.internal.DependencyManager] Failed to connect to host: https://dl.google.com/android/repository/addons_list-3.xml
17:12:46 17:12:55.513 [WARN] [com.android.build.gradle.internal.DependencyManager] Failed to connect to host: https://dl.google.com/android/repository/addons_list-2.xml
17:12:46 17:12:55.514 [WARN] [com.android.build.gradle.internal.DependencyManager] Failed to connect to host: https://dl.google.com/android/repository/addons_list-1.xml
17:12:46 17:12:55.515 [WARN] [com.android.build.gradle.internal.DependencyManager] Failed to download any source lists!
17:12:46 17:12:55.516 [WARN] [com.android.build.gradle.internal.DependencyManager] java.net.UnknownHostException: dl.google.com
17:12:46 17:12:55.543 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
17:12:46 17:12:55.544 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
This is the contents of gradle.properties.
systemProp.http.proxyHost=proxy.server
systemProp.https.proxyHost=proxy.server
systemProp.http.proxyPort=8080
systemProp.https.proxyPort=8080
I have attempted passing in proxy settings with jvm flags, and tried gradle versions 3.3 to 3.5. Is there anything that I'm missing?
For me the issue was the http
prefix! If this is your case, remove http/https
prefixes!
I had my gradle.properties like this, and was failing:
systemProp.http.proxyHost=http://squid.proxy.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=http://squid.proxy.com
systemProp.https.proxyPort=8080
Proper way to set proxy settings for gradle is:
systemProp.http.proxyHost=squid.proxy.com systemProp.http.proxyPort=8080 systemProp.https.proxyHost=squid.proxy.com systemProp.https.proxyPort=8080
You have to add the following configuration in gradle.configuration
.These are the proxy settings needed to be configured if you are working behind proxy.
Source: (https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy)
And don't add 'http.// or 'https:' in systemProp.http.proxyHost
only 'www.host.com'
.Also comment out the systemProp.http.proxyUser
or proxypassword
if you don't need it to login into the proxy.
systemProp.proxySet=true
systemProp.http.keepAlive=true
systemProp.http.proxyHost=www.host.com
systemProp.http.proxyPort=port
systemProp.http.proxyUser=username_ifneeded
systemProp.http.proxyPassword=password_needed
systemProp.http.nonProxyHosts=local.net|some.host.com
systemProp.https.keepAlive=true
systemProp.https.proxyHost=host
systemProp.https.proxyPort=port
systemProp.https.proxyUser=username_ifneeded
systemProp.https.proxyPassword=password_ifneeded
systemProp.https.nonProxyHosts=local.net|some.host.com
来源:https://stackoverflow.com/questions/44109325/gradle-installation-having-a-proxy-issue