unlimited101
unlimited101

Reputation: 3803

How to analyze https traffic from Android 6 emulator with Charles Proxy

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:

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?

Upvotes: 7

Views: 4953

Answers (2)

TTransmit
TTransmit

Reputation: 3350

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:

  1. 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.

  2. In Charles, the following should be set: Proxy > Proxies 8888 Enable transparent proxying should be checked; Proxy > macOS Proxy should be checked

  3. 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

  4. In the emulator, Settings > Developer Options > Use legacy DHCP client should be on.

  5. 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

Upvotes: 3

Jason Grife
Jason Grife

Reputation: 1317

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).

Upvotes: 3

Related Questions