Mitmproxy and Android

Created: May 16, 2018


Debugging network traffic for your app can be useful, and sometimes necessary if the data is not what is expected or inconsistent.

The Proxy

I prefer the open source proxy mitmproxy. Easy to install on OSX with homebrew.

brew install mitmproxy

I’ll leave it up to you to explore its greatness, I just wanna clarify the android setup.


1) mitmproxy

Choose a port (ex. 8888) and start the program: mitmproxy -p 8888:


If you prefer a web interface mitmweb:


2) Android

Find your local machine IP address, on OSX this can be found in network preferences. For example

Alternatively, find your public IP address on For example

2.1) Emulator

a) Open the extended controls from the emulator.

extended controls

b) Go to Settings and click on the Proxy tab. Enter your IP address and a port. emulator proxy

2.2) Device

Download a proxy app and enter the same settings.

2.3) Certificates

a) Open the mitmproxy portal to download its HTTPS certificate:

mitm cert

b) Download the Android certificate and install it. Name it whatever your want.


Starting in Android N, user certificates are not used by default. Your app will have to define a network configuration to use the certificate.

Configuring this is possible only during debugging using the debug-overrides directive.

<?xml version="1.0" encoding="utf-8"?>
            <!-- Trust preinstalled CAs -->
            <certificates src="system" />
            <!-- Additionally trust user added CAs -->
            <certificates src="user" />

comments powered by Disqus