Keywords: Charles Proxy | Android Debugging | HTTPS Sessions | SSL Configuration | Network Security
Abstract: This technical article provides a detailed guide on configuring Charles Proxy with Android devices to capture and analyze HTTPS session data. Focusing on compatibility issues in Charles 3.7, the solution emphasizes upgrading to Charles 3.8 Beta. The article covers proxy settings, SSL configuration, Android network setup, certificate installation, and includes code examples for network security configuration files, offering mobile developers a complete HTTPS debugging solution.
Introduction
Monitoring and analyzing HTTPS sessions is crucial for debugging network requests in mobile application development. Charles Proxy, as a widely used HTTP proxy tool, effectively intercepts and displays network traffic data. However, developers often encounter issues where HTTPS session data disappears quickly or fails to display when configuring Charles Proxy with Android devices.
Problem Analysis and Solution
Based on user feedback and technical community experience, Charles version 3.7 has known compatibility defects on Android devices, which may cause SSL sessions to briefly appear and then vanish in the Charles interface. Verification shows that upgrading to Charles 3.8 Beta version effectively resolves this issue, ensuring HTTPS session data remains stable in Charles displays.
Charles Proxy Configuration
First, complete the basic proxy configuration on the computer:
- Launch the Charles application and navigate to proxy settings
- Enable SSL proxying in the SSL proxy settings
- Add host locations to monitor, supporting wildcard configurations for multiple domains
These configurations ensure Charles can correctly intercept and decrypt HTTPS traffic, laying the foundation for subsequent session analysis.
Android Device Configuration
On the Android device side, network proxy and certificate configuration are required:
- Access Wi-Fi settings, modify proxy configuration for the current network connection, pointing to the computer IP address running Charles and the port (typically 8888)
- Access the Charles certificate download page through the device browser, obtain and install the SSL certificate
- Verify in security settings that the certificate is successfully installed and set to trusted status
Advanced Configuration and Network Security
For Android 7.0 and later versions, the system imposes strict restrictions on certificate trust policies. Developers need to add network security configuration files in applications, explicitly allowing user-installed CA certificates:
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user-added CA certificates in debug builds only -->
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>This configuration file needs to be referenced in the application manifest:
<application android:networkSecurityConfig="@xml/network_security_config">
...
</application>Verification and Testing
After completing all configurations, restart the target application on the Android device. Complete HTTPS request and response data should be visible in Charles. If issues persist, consider checking the following aspects:
- Confirm Charles and Android device are on the same local network
- Verify proxy port settings are correct
- Check certificate installation status and trust settings
- Confirm application network permission configurations
Conclusion
By upgrading Charles to version 3.8 Beta and combining proper proxy and certificate configurations, developers can effectively resolve HTTPS session monitoring issues on Android devices. The configuration methods and code examples provided in this article offer practical technical guidance for network debugging in mobile application development, enhancing development efficiency and problem-solving capabilities.