if you still have problems building gradle after viewing all the topics in Stack, as I did in the last two days, there might be something else that you should check, if you used Proxy before, there are two files with named gradle.properties in your Gradle package.
if you used a proxy before the opportunity arose that android studio would add this information to one of these gradle.properties files, so take a look at both of them, and if you see something like:
systemProp.https.proxyHost=your_proxy_host systemProp.https.proxyPort=your_proxy_port systemProp.https.proxyUser=your_proxy_username systemProp.https.proxyPassword=your_proxy_password
or
systemProp.http.proxyHost=your_proxy_host systemProp.http.proxyPort=your_proxy_port systemProp.http.proxyUser=your_proxy_username systemProp.http.proxyPassword=your_proxy_password
just delete them, then invalidate the cache and restart your android studio and run the project, I'm sure you will be fine.
Arash afsharpour
source share