Use Cahrles to capture packets in the Android Emulator

Packet capture is a good way to obtain software data interaction. In Windows, we often use The Wiresharks to capture packets. Today I will introduce Charles is also a very good packet capture software

1. Download and install

Enter the website www.charlesproxy.com/download/ click on…

2. The configuration

After installation, open Charles

Go to Proxy->SSL Proxy Settings

This is configured to capture Https packages, then go to Help->SSL Proxying->Install Charles Root Certification

Click Install Certificate

Complete can catch the PC package

3. Install the simulator

Since I am using the built-in Emulator of Android Studio, I will demonstrate the configuration on the emulator

The IP address must be configured based on the local IP address (you can view the IP address through ipconfig in Windows). The port is usually 8888. You can view the IP address through Proxy->Proxy Settings

We need to install the CA certificate on the Android device, and access chls.pro/ SSL in the browser to download the certificate. However, it may not be downloaded or the location of the certificate can not be found. We can also go to this address on the PC and download the certificate, and then drag and drop it onto the Android emulator

If you click Install, the installation may fail

This is because on higher versions of Android, Google prohibits individuals from installing certificates for security reasons. You can go to Settings->Security->Encryption & Credentials ->Install a certificate

Just select the certificate you just downloaded and install it, and then you are ready to capture packets.