i have tried it many times but its giving me same error.how to set the proxy so that this error is solved
On your android studio goto file -- settings -- Build, Execution, Deployment --Build Tools -- Gradle and choose Use local gradle distribution, in the gradle home locate your gradle folder and click apply. Then click okay. This solved the problem for me.
To set the HTTP proxy settings in Android Studio: From the menu bar, click File > Settings (on macOS, click Android Studio > Preferences). In the left pane, click Appearance & Behavior > System Settings > HTTP Proxy.
Go to..
File > Settings > Appearance & Behavior > System Settings > HTTP Proxy Enable following option Auto-detect proxy settings
and press checkConnection button for test
In my case issue occurred after following:
I selected proxy settings from Android Studio settings when I was working in a network behind a proxy. When I disconnected from that network and connected to home network which doesn't have a proxy, I removed the proxy settings from Android Studio, but gradle seemed to take the old proxy settings.
The problem was that gradle had also saved the proxy settings in following file when I set proxy settings in Android Studio, but it hasn't got removed when I removed proxy settings from Android Studio.
%HOME%\.gradle\gradle.properties
When I removed the proxy settings from this file, gradle sync worked again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With