Update 2022: proxyman or httptoolkit may be simpler to setup and use on multiple different operating systems than Fiddler. To use the android network TLS interception the device must be connected to the computer and proxyman should be installed on the computer.
Checking network activity is a very important task especially when your app is accessing an API.
However the emulator runs in a virtual environment and hence is often not picked up by default on network sniffing debugging and activity tools.
Fear not we can use Fiddler to view network requests made on your android emulator or even a test device.
Even better we can do this on a linux machine.
How to Install Fiddler
On Windows: Download Fiddler to view network traffic
On Linux (ubuntu):
- Install Mono – an open source implementation of the .net framework (basically lets you run .exe on linux)
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list sudo apt-get update sudo apt-get install mono-complete
- Download Fiddler for Mono
- Run Fiddler
mono Fiddler.exe
-
Tools -> Fiddler Options -> Connections -> Make sure Allow remote computers to connect is checked
Set your Emulator or Device to Proxy Traffic to Fiddler
On the device
- Go to Settings
- Select Wifi
- Hold down the wifi connection for 2 seconds
- Click Modify Network
- set the Following:
Proxy Hostname: 10.0.3.2 (Genymotion Emulator) | 10.0.2.2 (Normal Emulator) Proxy port: 8888
- Turn Off and On The Wifi to Refresh
Start Debugging
Now your life is made a little bit easier you can check the headers, cookies and form data sent with requests and check responses.