For the purpose of this tutorial, I used a Samsung Galaxy S9 running Android 9.
Before you start, make sure that both the target device and the proxy (the computer running mitmproxy) are on the same network.
On the target device, open Settings > Connections > Wi-Fi, show informations from your current network (hit the network you are already connected to) and select Advanced.
Change the proxy setting to Manual and set the following values :
- Proxy host name : the local IP address of your computer running mitmproxy
- Proxy port : 8080
- Leave other fields blank or with default value
To get the local IP address of the computer serving as proxy, generally the easiest way is to open its network settings (Settings > Network on MacOS) and look for its local IP address, 192.168.1.42 in this example :