I want to analyze the https traffic of the app I am developing for Android.
Charles Web Debugging Proxy is the tool I want to use for that. I have the following system configuartion:
I already read several posts on StackOverflow like e.g.
But still I didn't reach my goal. I walked through all the important steps:
~/Library/Android/sdk/tools/emulator -netdelay none -netspeed full -http-proxy <IP_FROM_DEVICE_WITH_CHARLES_PROXY_INSTALLED>:8888 -avd Nexus_5_API_23
I can read all the http traffic in Charles Proxy without any problems. I also can read the https traffic but Charles only lists IP addresses. There are entries like
https://173.194.65.188:5228
So the ip addresses are not resolved. How to get real https URLs? Do I have to activate DNS for https somewhere?
In Charles go to the Help menu and choose "SSL Proxying > Install Charles Root Certificate". Keychain Access will open. Find the "Charles Proxy..." entry, and double-click to get info on it. Expand the "Trust" section, and beside "When using this certificate" change it from "Use System Defaults" to "Always Trust".
Open Charles. Go to Proxy > Proxy Settings > SSL. Check “Enable SSL Proxying” Select “Add location” and enter the host name and port (if needed)
I too found this to be an issue. My solution when I want to debug network traffic via Charles Proxy, is to switch over to Genymotion emulator. The Genymotion emulator will give you the url(s) vs. ip(s) in Charles.
In the Genymotion emulator you configure the Wifi proxy hostname to '10.0.3.2' and Proxy port enter '8888' (*assuming port 8888 is the listening port you have configured in Charles Proxy).
There are instructions that make the Android emulator work with Charles here:
https://stackoverflow.com/a/35577864/2832027
It is quite unreliable. You need to put the emulator in and out of airplane mode if it was working and then stops working.
Here are the steps from the above post:
Start the emulator from the terminal with /{path to your android
sdk directory}/tools/emulator -avd Nexus_5X_API_23 -http-proxy
http://192.168.2.38:8888
where the -avd
value is the name of your
emulator and the -http-proxy
value is the ip address from Charles:
Help > SSL Proxying > Install Charles Root Certificate on a Mobile
Device or Remote Browser.
In Charles, the following should be set:
Proxy > Proxies 8888 Enable transparent proxying
should be
checked; Proxy > macOS Proxy should be checked
In the emulator, `Settings > More (Wireless > Cellular Networks > Access Points > T-Mobile US (or whichever other network is there) set Proxy to 10.0.2.2 and port to 8888
In the emulator, Settings > Developer Options > Use legacy DHCP
client should be on.
In the emulator, turn Airplane mode on and off
Also, see this if you have issues getting Charles working on Android 7 (API 24) and above. https://android.jlelse.eu/android-nougat-charlesing-ssl-network-efa0951e66de
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With