Install Android SDK thru Proxy with Authentication

Today I was trying to download and install additional SDK R5 components from Internet using the Android SDK and AVD Manager tool. Initially, the download was continuously failed, because, my system is behind a Proxy, which need an authentication. Android SDK and AVD Manager does not provide any option in the proxy settings, to include the proxy authentication (user name and password) details.

So I decided to run my own proxy server locally and configure it to talk to the parent (original) proxy server with authentication detail. Initially, I decided NOT to run the heavy weight proxy Squid and selected TinyProxy for this purpose. But TinyProxy not supported the Authentication feature. So finally ended up running Squid proxy with following configurations:

# Listen only local interface

# Parent proxy ( and Authentication settings
cache_peer parent 8080 0 no-query default login=User:Passwd

# No direct access
never_direct allow all

After restarting the Squid, I changed the proxy settings of Android SDK and AVD Manager to:

Port: 3128

After this, restarted it. Now the additional components are successfully downloaded.

Tagged with: ,
Posted in Uncategorized
26 comments on “Install Android SDK thru Proxy with Authentication
  1. Victor Bello says:

    Where can I get my hands on Squid for Windows?

  2. Bharathi Subramanian says:

    Hi Victor, Check this link:

  3. Victor Bello says:

    OK, I got it, but after configuring it, I still get Authentication Failed on the android SDK. Any ideas? Maybe post the whole config file for squid?

  4. Bharathi Subramanian says:

    From the browser, Is it possible for you to goto Internet using the User:Passwd, which is mentioned in squid conf file.

  5. Shane says:

    After much messing around, I managed to get this working really easily.Edit android.bat, and in the call to java.exe, insert the following parameters VM parameters before -jar-Dhttp.proxyUsername="username" -Dhttp.proxyPassword="password"Note that there’s no space between D and http. You still need to put in the host/port in the settings.

  6. S. M. Das says:

    !!!Thank you Shane! Turns out, for the Linux SDK, it’s the very last line of the "tools/android" that these settings belong in.It was a super easy thing to patch… I should probably make those two fields available as command-line options to "android" and see if Google is interested in that feature. It is certainly the best way to make the updater useful behind an authenticated web proxy.

  7. Feliponcho says:

    I’m also behind a proxy but we use automatic proxy configuration url. Any idea on how to configure android.bat to use the conf url? thanks!

  8. rayshi says:

    I am also behind the scripted proxy. Does squid handle that kind of proxy?

  9. Feliponcho says:

    Hi, I just moved into Android 2.2 and the problem was solved. Also let me tell you that in my company have 2 proxies and 1 scripted proxy. I tried with one of the proxies and it didn’t work and with the other worked perfectly. I would recommend to talk with your tech support and see what options they have for you. BTW according to google support proxy definitively doesnt work in 2.1.

  10. For non technical people here is a step by step guide on how to set up proxy in Android

  11. Mayank says:

    Shane, can you mail or paste your modified android.bat file here

  12. shivang says:

    im using your freedom for bypassing the proxy and the installation runs fine but it stops at 93%, i dont know if its a problem just on my connection. u can try it to if it works for u all.

  13. pietro says:

    Start Manager and set proxy name and port in "settings" tab.Don’t put "HTTP" before proxy name.Edit android.bat file and change the lines before SetPath:rem Finally exec the java program and end %java_exe%"%tools_dir%" -Dhttp.proxyUsername="DOMAINUSER" -Dhttp.proxyPassword="PASSWORD" -classpath "%jar_path%;%swt_path%swt.jar" %* PIETRO

  14. Dan says:

    I can confirm Pietro’s solution worked for me

  15. Tarantini says:

    You can find file: androidtool.cfg on c:Documents and SettingsYOU USER NAME.androidand you add line "http.proxyLogin=USER@PASSWORD" and save the file and try open ANDROID SDKTaranttini –

  16. nanda says:

    installing a squid was a convenient solution.. thank you.was struggling a lot with it..

  17. sc says:

    pietro’s solution worked for me as well.

  18. zmf says:

    Thank you Tarantini(of course for linux its in ~/.android/androidtool.cfg)it work 🙂

  19. sfg says:

    install ccproxy on vmware,set your ip and u r ready 2 go

  20. Droid says:

    Thank you Pietro! Your solution worked flawlessly.

  21. tushar says:

    I tried a lot but can not be able to solve this problem I am in a college where proxy server is running with user name and password authorization pls send me a modified android.bat file at this e-mail address pls sir thanks in advance

  22. Zsolt says:

    Hello. I installed CCProxy on windows, then i was able to setup upper level proxy, and everything works like charm.

  23. Mario Bedeschi says:

    I have the same issue, after install eclipse works just find…. with eclipse you can provide user and pass word for your proxy. Then download ADT Plugin for Eclipse.Now you are able to work.RegardsMario Bedeschi

  24. Mouad Khateb says:

    @ Pietro @Dan @sc @Droid I am not sure but I think you meant AFTER ":SetPath" because what’s before it is not identical with the lines you provided. I assumed it is After, and now the end of my .bat file looks like this (after replacing the original lines that come after SetPath with the ones U suggested):_________________:SetPathrem Finally exec the java program and end %java_exe%"%tools_dir%" -Dhttp.proxyUsername="XXXXXX" -Dhttp.proxyPassword="XXXXXX" -classpath "%jar_path%;%swt_path%swt.jar" %*rem EOF__________________Yet this gives me "access is denied". Questino is, after Dhttp.proxyUsername should I only input the username, or the domain followed by the username? In what format should that be? Thanx

  25. Sandino Santos says:

    Thanks, thanks, thanks, thanks, and thanks from Brazil

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: