Saturday, 17 January 2015

Install Android Studio Behind A Proxy

So I've finally got Android Studio installed on my computer, took a bit of an effort cause the setup wizard doesn't quiet let you edit the android studio settings to add your proxy configurations.

"Connection failed. Please check your network connection and try again." While trying to install some sdk components that are required for it to work.

Something like "The following SDK components were not installed: extra-android-m2repository, tools, addon-google_apis-google-21, android-21, sys-img-x86-addon-google_apis-google-21, source-21, extra-google-m2repository" can be seen in the expanded log.

The problem is that Android Studio's Proxy settings are not configured and these are the steps you could follow to manually configure them (as it's not possible to configure them through GUI).

  • Step 1: Locate the  .AndroidStudio folder.
  • Step 2: Navigate to .AndroidStudio/config/options
  • Step 3: Edit the other.xml file.
    • Edit 1:  Replace  <option name="USE_HTTP_PROXY" value="false" /> with <option name="USE_HTTP_PROXY" value="true" /> .
    • Edit 2: Enter your proxy host configuration in <option name="PROXY_HOST" value="" /> , it should look something like <option name="PROXY_HOST" value="" /> .
    • Edit 3: Enter your proxy port into <option name="PROXY_PORT" value="" /> , mine looks like <option name="PROXY_PORT" value="8080" /> .
That's about it, you might need to enter extra details like login and password if your proxy requires them. Now try running the setup again and this time, it must be able to download all the required components and update the SDK :)

Please let me know if you have other problems, I'd be happy to help!