I am unable to build a project in Android Studio and I am receiving the following errors.
In addition to @mhaseebn answer I have deleted proxy entries in C:\Users<account_name>.gradle\gradle.properties of windows machine worked for me
i had the same problem on mac, remove http proxy setting from .gradle file in user directory
For me, all I had to do was go to C:\Users<account_name>.gradle\gradle.properties in Windows Explorer and replace the file contents with:
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
systemProp.http.nonProxyHosts=
systemProp.http.proxyHost=
systemProp.http.proxyPassword=
systemProp.http.proxyPort=80
systemProp.http.proxyUser=
systemProp.https.nonProxyHosts=
systemProp.https.proxyHost=
systemProp.https.proxyPassword=
systemProp.https.proxyPort=80
systemProp.https.proxyUser=
Then sync my gradle and accept settings and all started working well.
go to file>settings and find http proxy click on manual proxy configuration and select http
I found the solution.
Bingo!