Use the Android SDK Emulator with Eclipse behind a Proxy

In the office we have a pretty stern internet proxy and I needed to test something from the Android Emulator using the network today, and therefore the Proxy. This seemed like a simple thing to do, and there are instructions for adding proxy information when launching the Emulator  on the Android Developer site (http://developer.android.com/guide/developing/tools/emulator.html#proxy). So I went into preferences for Eclipse, chose the Android preferences and sure enough, on the lunch tab there is a field for parameters when launching the Emulator. I added the proxy string there as per the document (-http-proxy user:pass@server:port) e.g.

-http-proxy http://user:pass@proxy.example.com:1234

but it did not seem to take. A little searching in some forums solved this however. I am adding it here with a title that matches what I was searching for via Google so that the next person can find it without reading a lot of forum threads.

The trick is that you need to add this info on for the project you are going to be running it from, and there is a convenient place to do so in Eclipse. With the project selected,  choose “Run” from the menu bar at the top, then “Run Configurations” This will show all the run configurations, and have the current project selected. You can also choose the Run/Configurations items from any project and select the correct one once inside. Once a configuration is chosen, choose the “Target” tab from the tabs on the right side of the Run Configurations dialog and look for the Text field labeled “Additional Emulator Command Line Options”. I had to resize the Dialog window to get this box to appear as there are no scrollpanes used there (I am using Linux version 3.5.2. of Eclipse). Below are a couple screen shots of these dialogs.



Follow

Get every new post delivered to your Inbox.