Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set proxy authentication for Android sdkmanager from command line?

I want to pass proxy authentication (username and password) along with proxyhost and proxyport

currently Android sdkmanager supports --proxy_host and --proxy_port (in command line)

our proxy server has authentication also (username and password)

Thanks in advance.

like image 549
SHASHIDHAR MANCHUKONDA Avatar asked Nov 19 '22 13:11

SHASHIDHAR MANCHUKONDA


1 Answers

On Linux, you can export proxy environment variable, then run sdkmanager command

export http_proxy=http://[USERNAME]:[PASSWORD]@[PROXY_ADDRESS]:[PROXY_PORT]

For https proxy

export https_proxy=https://[USERNAME]:[PASSWORD]@[PROXY_ADDRESS]:[PROXY_PORT]

If the above command does not work, try

_JAVA_OPTIONS="-Dhttp.proxyHost=[PROXY_ADDRESS] -Dhttp.proxyPort=[PROXY_PORT] -Dhttp.proxyUser=[USERNAME] -Dhttp.proxyPassword=[PASSWORD]" bash -c "sdkmanager '[SDK_COMPONENT]'"

This is because command sdkmanager will run as a normal java application. It will apply the options you specified in the command line.

like image 88
cmoaciopm Avatar answered Dec 17 '22 11:12

cmoaciopm