SoFunction
Updated on 2025-04-04

Android Studio Agent Configuration Guide (Summary)

Android Studio users' proxy configuration guide, a truly effective way to configure gradle proxy. #It’s really autistic to not be able to reliably rely on it. I don’t want to be autistic again and again, so I write it down.

IDE HTTP Proxy

Under Windows, Ctrl + Alt + S, and then enter Proxy to see the settings of HTTP Proxy. The specific path is Appearance & Behavior > System Settings > HTTP Proxy. The corresponding settings on macOS is Preferences.

In most cases, you should use * as the proxy client. If so, then this is the following:

Select Socks under Manual proxy configuration, then fill in Host name (usually 127.0.0.1) and Port number, and then try Check connection and try it. This is mainly a configuration used by Android Studio, which checks and updates, reports usage status, etc.

Gradle Proxy

Replace maven warehouse
Edit the root directory of the project, modify the content of the repositories block, add the maven image of Alibaba Cloud. After modifying, the file will look like this:

buildscript {
  ext.kotlin_version = '1.3.11'
  repositories {
    maven { url '/nexus/content/groups/public/' }
    google()
  }
  dependencies {
    classpath ':gradle:3.3.0'
    classpath ":kotlin-gradle-plugin:$kotlin_version"
  }
}

allprojects {
  repositories {
    maven { url '/nexus/content/groups/public/' }
    google()
  }
}

Configure the proxy

Configuring Alibaba Cloud maven mirroring can speed up synchronization and solve most of the problems. However, some things may still rely on Google's repository (but it seems that they can be directly connected), but various problems may still occur from time to time. Therefore, it is necessary to configure the following proxy.
The most circulating method of setting up agents is mainly to add this configuration:

=127.0.0.1
=1080
=127.0.0.1
=1080

However, the above setting is invalid for socks proxy. You can try adding:

=socks5://127.0.0.1
=1080

Of course, it may not work. If it doesn't work, change it to:

=-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=1080

Plan pass!

Change the global configuration

Apply the above changes to ~\.gradle\ (this is the default location for the global configuration of gradle on Window) and can take effect on all projects

Transparent Agent

This is a better choice, or it is also good to use a VPN to return to the company and get back to the Internet.

The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.