one solution for this problem
go to the proxy settings,
File > setting > Appearance & Behavior >System Settings > HTTP Proxy
or by
clicking ctrl+alt+s.
And set no proxy if you not use proxy
or
set Auto-detect proxy settings.
if it is not work fine.
you can this way
go to Gradle Scripts in your project and inside that you have file with name gradle.properties(Global Properties). not go to the gradle.properties(Project Properties) file.
bottom of that file you can see some proxy settings.
if you not use the connection with proxy you can remove that part.
if you use the proxy you should check that correct or not.
////////////////////////////////////////////////////////
file location in my way
C:\Users\HP.gradle\gradle.properties
////////////////////////////////////////////////////////
systemProp.http.proxyHost=192.168.0.10
systemProp.http.proxyPort=3128
systemProp.https.proxyHost=192.168.0.10
systemProp.https.proxyPort=3128
/////////////////////////////////////////////////////////
if you use proxy keep it like this with your proxy settings
## 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
#Wed Mar 17 08:43:50 IST 2021
systemProp.http.proxyHost=192.168.0.10
systemProp.http.proxyPort=3128
systemProp.https.proxyHost=192.168.0.10
systemProp.https.proxyPort=3128
if you not use proxy keep it like this
## 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
#Wed Mar 17 08:43:50 IST 2021