Sample Android Project
1. What's it?
Intercepting HTTPS traffic on Android Devices and Android Emulators is more complicated than on iOS.
If you've struggled to config XML settings, let's check out this sample project that we've already configured for you:
Check out the Sample Config section to understand how the config is set up.
2. Prepare
Android Studio
Pixel 5 Emulator with API 31+ (We suggest that we should create a brand-new Emulator device rather than using the current one. Visit Android Virtual Devices windows in Android Studio)
Clone or download the project at https://github.com/ProxymanApp/OKHTTP-Android-Sample
"Small and Medium Phone" Android Emulator doesn't allow Proxyman or other MitM apps to decrypt HTTPS traffic.
✅ We suggest using Pixel Emulator (Google APIs version).
3. Configuration
You might either follow steps 3.1 or 3.2:
3.1 Android Emulator with the Automatic Script
If you run this project on Android Emulator (Google APIs version), you can check out the Automatic Script and Proxyman provides to:
Clone or download the project: https://github.com/ProxymanApp/OKHTTP-Android-Sample
Make sure you can run the project in Android Studio with Android Emulator (API 31)
Open Proxyman -> Certificate Menu -> Install Certificate for Android -> Emulator
Click on the "Override Emulator" button to automatically set the HTTP Proxy & Install & Trust the certificate.
You don't need to config the file res/xml/network_security_config.xml and AndroidManifest.xml since the project is already configured.
Back to the Emulator -> Click on Say Hello -> Observe the HTTPS log on Proxyman
Done
3.2 Physical Android Devices
For Physical Devices or Emulator (without using the automatic script), it's more complicated and error-prone. Please carefully follow each following steps:
3.2.1 Set HTTP Proxy to Proxyman
Open your Android Device -> Setting app -> Wifi: Make sure your Wifi connection is good. Sometimes, it's "Limited Connection" that you could not set the Wifi Proxy. If it happens, please remove the emulator and create a new one again.
Click on the Wifi then clicking on Edit Button.
Start set HTTP Proxy that the same IP and Port value from Android Guideline (Proxyman app -> Certificate -> Install Certificate on Android Devices)
Make sure the Proxy Hostname and Port match with the values in (Proxyman app -> Certificate -> Install Certificate on Android Devices)
2.3 Download and Install Proxyman Certificate
Open Google Chrome on your Android devices
Visit http://proxy.man/ssl
Download the Certificate and select VPN and App Category
On Android 12+, If you encounter this warning "Can't install the Certificate: This file can't be used as a VPN & app user certificate", please try to select "CA Certificate" instead.
4. On Android 11 and Android 12. Let's verify by opening Trusted Credentials -> User Tab.
Make sure you can see Proxyman CA Certificate like the below screenshot.
5. You don't need to config the file res/xml/network_security_config.xml and AndroidManifest.xml since the project is already configured.
6. Back to the Emulator -> Click on Say Hello -> Observe the HTTPS log on Proxyman
7. Done
4. Sample Config
AndroidManifest.xml
res/xml/network_security_config.xml
4. Troubleshooting
Depending on the Android Emulator and API version, you might encounter some errors.
1.After setting the Wifi Proxy in Android Studio, I could not visit http://proxy.man/ssl
=> Please try to restart the Emulator and make sure the Wifi Status in Emulator is "Connected"
=> Delete your Android Emulator and create a new one
2. I get SSL Errors when intercepting HTTPS traffic
=> Sometimes, your Android Emulator doesn't load Proxyman Certificates => Please stop the project and start again.
=> Make sure your domains are listed in res/xml/network_security_config.xml
3. Android Device connection is often dropped and hardly connect
=> Try to add 8.8.8.8 as a DNS on your current Mac Wifi.
Discussion at https://github.com/ProxymanApp/Proxyman/issues/636
Last updated