Starting Android Studio behind a proxy

I recently installed the latest (stable) version of the new Android Studio, the one based on IntelliJ IDEA.
The installation went OK but when i started the program, it remained stuck in the splash screen, with a message box saying: “getting Android SDK Component information” or something like that. Then, after 10 minutes or something, it finally timed out and loaded another screen, the Setup Wizard, that should help you configure Android Studio on the first startup. Same thing happend, it remained stuck for about 20 minutes, then told me that something was wrong and so the application could not be started. That’s it, it seems that you can’t do anything about that.
As you might imagine, it’s a network related problem. Actually it is clearly stated that you should have a stable internet connection to run Android Studio without incurring into any problem. The point is I had a stable and fast Internet connection so the problem came down to the network proxy. After I tried to start AS without Internet (it failed immediately) and with a tethering connection with my phone (it quickly moved on from the first screen and greedily tried to download all the things from my phone), I was in a weird situation where I really needed to tell AS to use a proxy before starting but, unluckily, I could not do that without starting it and, without the right proxy setting, it won’t start.
Or will it… I also have a clean Intellij IDEA installation on my computer so I thought that, since they are basically the same thing, I could try to set the proxy on IDEA and see what happens. Hopefully it stores the information in some human readable configuration file and I can steal that snippet and paste it on the corresponding AS file.
After a bit of searching, it turns out that it is exactly the case. I found the file other.xml in the folder %HOME%\.IdeaIC12\config\options, where %HOME% is, quite obviously, your home folder under Windows.
The desired snippet is the following:


<component name="HttpConfigurable">
    <option name="PROXY_TYPE_IS_SOCKS" value="false" />
    <option name="USE_HTTP_PROXY" value="true" />
    <option name="USE_PROXY_PAC" value="false" />
    <option name="PROXY_HOST" value="101.116.3.251" />
    <option name="PROXY_PORT" value="3128" />
    <option name="PROXY_AUTHENTICATION" value="false" />
    <option name="PROXY_LOGIN" value="" />
    <option name="PROXY_PASSWORD_CRYPT" value="" />
    <option name="KEEP_PROXY_PASSWORD" value="false" />
    <option name="myGenericPasswords">
      <map />
    </option>
    <option name="myGenericCancelled">
      <set />
    </option>
    <option name="PROXY_EXCEPTIONS" value="localhost,127.0.0.1,101.*" />
  </component>

You can copy and paste it under the corresponding other.xml under %HOME%\.AndroidStudio\config\options and it will do the trick.
Done this, AS started without any problem.

7 thoughts on “Starting Android Studio behind a proxy

  1. Hi,
    I’m not sure because I do not use it, but I would search for the file in the corresponding path ($HOME/.AndroidStudio/config/options).
    Maybe a search with “locate” could help if you still do not find it.
    Bye.

  2. Hi Anamika.
    Can you find the folder named ‘.AndroidStudio’ inside your home folder?
    If not, I can only suggest to start a system wide search for the file. I’m sorry but I’m not using Android Studio on Windows 7 and I cannot do a test at the moment, though I would expect that the places where it saves its stuff were the same…

Leave a comment