Body
Method 1: Temporary command-line approach
1 | sdkmanager --verbose --no_https --proxy=http --proxy_host=<host> --proxy_port=<port> "<package>" |
Where:
proxy_hostis the proxy host; use127.0.0.1for local.proxy_portis the proxy port.- Append the dependencies you want to install at the end.
Method 2: Permanent modification (requires editing the .bat file)
I’m using Windows; other systems should be similar.
Locate the file:
1
2# Windows
%ANDROID_HOME%\cmdline-tools\latest\bin\sdkmanager.batFind the line containing
%CMD_LINE_ARGS%, near the end of the file, starting with"%JAVA_EXE%" %DEFAULT_JVM_OPTS%.Change it to:
1 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %SDKMANAGER_OPTS% -classpath "%CLASSPATH%" com.android.sdklib.tool.sdkmanager.SdkManagerCli --verbose --no_https --proxy=http --proxy_host=<host> --proxy_port=<port> %CMD_LINE_ARGS% |
Remember to adjust the relevant parameters inside.
After this configuration, every time you use sdkmanager from the command line, the proxy will be applied automatically.