Gradle Sync failed while using proxy server

Apparently this code works

systemProp.http.proxyHost=<hostname>
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=
systemProp.http.proxyPassword=
systemProp.http.nonProxyHosts=localhost

or for https

systemProp.https.proxyHost=<hostname>
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=
systemProp.https.proxyPassword=
systemProp.https.nonProxyHosts=localhost

when password isn't set up. It should be in gradle.properties file.