The Charles Web Debugging Proxy is a near mandatory tool for any developer. Getting it to work with your desktop apps is usually very easy since it just…works. However, for use with mobile, there are a couple tricks.
Configuring for the iOS Simulator
The iOS Simulator is a native app that “imitates” your iTouch device. Because of that, the only configuration you need is to install the Charles certificate. You can do that by downloading and running this special script on your Mac. (There’s no Windows configuration for this because you can’t run the iOS simulator on windows.)
Restart Charles and your simulator to be assured of a working connection.
Configuring for Genymotion/Android
We’re going to ignore the official Android emulator because you shouldn’t be using it anymore anyway. So, we’ll use Genymotion for this example. Since it’s a virtual machine, and not native, you need to relay the network connection to your local machine. If you don’t, Charles can’t see the internal Genymotion network and none of the requests will be seen.
First, we’ll need the Charles certificate:
- Download the Charles certificate for Android.
- Unzip and drag and drop it on to your running Genymotion device.
- Run the “File Manager” app on your Genymotion device and open your Download directory there.
- Tap the certificate to install. (You may be asked to set up a security code first.)
With that done, now you need to configure a proxy to get the network traffic running through your desktop. Follow these steps exactly:
- Open Settings and tap Wi-Fi to see your wireless connections.
- You should see something like “WiredSSID”. Tap and hold it until a menu appears.
- Select “Modify network”.
- Change the “Proxy settings” to Manual.
- Change the “Proxy hostname” field to 10.0.3.2. This is a special Genymotion IP address so don’t try setting it in the original Android emulator. It won’t work!
- Tap Save.
Restart Charles and Genymotion to be assured of a working connection. And remember, you’ll need to perform these two operations for every new Android device you create because they’re all physically separate.
If you now run an app you’ll see the network connections appear. You’ll still have to configure SSL settings to see encrypted traffic, but that’s explained clearly in Charles and is up to you.