Debug HTTP requests from Android Emulator
As a LAMP website developer I frequently needed some simple way to track raw HTTP traffic from the application to analyze requests the application sends and responses it receives. Very famous and easy to use tool which I use for this is Fiddler.
Fiddler is a Web Debugging Proxy which logs all HTTP traffic between the computer and the Internet. Fiddler allows me to inspect all HTTP traffic, set breakpoints, and "fiddle" with incoming or outgoing data. It is very flexible and has many configurable options. More detailed information is available on the official site of Fiddler.
As far as I started developing for the Android I've got the same need - some how I need to track requests my application sends. Again and again Fiddler comes up to help me. Let's see how we can setup it to catch requests from native Android emulator.
First of all we need to download and install Fiddler. Installation process is pretty easy and shouldn't make any questions.
Then we need to tell Eclipse that we want to launch emulator with the following command line option:
-http-proxy 127.0.0.1:8888
This will tell the emulator that we want it to send all requests through the proxy server. 127.0.0.1 and 8888 are IP address and port of the Fiddler respectively.
To do so in Eclipse we'll go to Run > Run Configurations > Android Application > My Project name > Target. In the very bottom of the window we'll put our command line option to Android Emulator Command Line Options field and apply changes.
It's done! Next time you launch the emulator from Eclipse it will send all requests through Fiddler and you'll be able to track them and handy way. Just don't forget to launch Fiddler before the emulator.
Comments (2): leave a comment
Please let me know if you find a way to set proxy server setting in common emulator configuration. Thanks in advance.