Wednesday 9 May 2012

Debugging Android Emulator HTTP/S Traffic

The project that I am involved in at work is very network centric and I found my team having to support a third party using the Android SDK to develop an application that used the services exposed by my project.  One of the most important tasks anyone on my team can do is debug the network requests being sent by the third party application to the network services.

The Android Emulator is not the friendliest in the universe.  But..

Download Charles - A very useful tool (for OSX)


Using Charles (I have a Mac)
1. Go - Proxy -> Proxy Settings -> Enable Transparent HTTP Proxying
2. Proxy -> Proxy Settings -> SSL -> Enable SSL Proxying (if that's what you need)
3. Proxy -> Proxy Settings -> SSL -> Add : Your service end point here!
4. Help -> Local IP Address : Write this down

From the Emulator
1. Open a Web Browser -> http://www.charlesproxy.com/charles.crt -> Save to Device -> Set up PIN (if you're doing SSL debugging)
2. Settings -> Wireless & Networks (Maybe -> More) -> Mobile Networks -> Access Point Names -> TelKila -> Proxy : The IP Address you wrote down
3. Settings -> Wireless & Networks (Maybe -> More) -> Mobile Networks -> Access Point Names -> TelKila -> Port : 8888 (unless you've changed the default port for Charles)
 
All Set!

4 comments:

  1. Jon, This was extremely and saved me hours of work. Thanks for posting!

    ReplyDelete
  2. Thank you for this blog post. FWIW the same thing works on a device too. I spent a long time searching the web to make charles successfully show me SSL traffic even after enabling SSL proxy for *:*. The trick was to install the charles certificate on the device - had missed that.

    ReplyDelete
  3. I wish I had found this sooner. Had not occurred to me to download the cert from the device. Thank you kindly for this documentation!

    ReplyDelete