This is a migrated thread and some comments may be shown as answers.

Not possible to capture https traffic from Android emulators

3 Answers 9236 Views
Mobile
This is a migrated thread and some comments may be shown as answers.
Niklas
Top achievements
Rank 1
Niklas asked on 11 Oct 2020, 08:15 AM
I'm using Fiddler to capture traffic from Android phones. I have followed the steps in https://www.telerik.com/blogs/how-to-capture-android-traffic-with-fiddler and I can capture https traffic just fine on a physical device. However when using an Android emulator I am unable to capture any traffic.

I'm using an Android 5.1 system image to be sure that the Android 7 change with ignoring user-installed root certificates does not affect me. When trying to load an https page like https://example.com in the default browser on the emulator the initial CONNECT request gets closed immediately according to fiddler and after a very long time the browser times out and shows an net::ERR_CONNECTION_REFUSED error.

See the attached screenshot for what this looks like in Fiddler.

Here are some setups that I've tried:
* Fiddler 5.0.20202.18177 on two different Windows 10 computers
* Using the emulator bundled with Android Studio on the same computer as I'm running Fiddler
* Using the emulator bundled with Android Studio on a Linux computer on the same network as I'm running Fiddler
* Using the Genymotion emulator, on the same computer as I'm running Fiddler

In all these cases http traffic is captured fine but https traffic can not be captured.

In addition to this I've also tried swapping out Fiddler with both Burp suite and mitmproxy and when doing this I can capture https traffic from emulators just fine. It seems like there is some problem with Fiddler and Android emulators rather than my setup.

Please let me know if there there is any other information I could provide to help resolve this issue. I really like Fiddler and would hate it if I had to use Burp suite or similar when working with emulators.

3 Answers, 1 is accepted

Sort by
0
Accepted
Nick Iliev
Telerik team
answered on 12 Oct 2020, 05:24 AM

Hello Niklas,

I've recently described the setup steps needed for Android real devices and emulators. There is a small difference when using emulators when setting the proxy address. For AVDs, the IP address that needs to e used is 10.0.2.2 (for real devices, it is usually something like 192.168.0.1), I've described the steps in detail for the new Fiddler Everywhere, but you can use them as reference for the classic FIddler as well. Gernymotion emulators are using another IP address usually 10.0.3.2.

https://docs.telerik.com/fiddler-everywhere/knowledge-base/configure-android#configure-android-device

Note that the steps are using port 8866 for Fiddler Everywhere, where you should use port 8888 for the classic Fiddler.

 

Regards,
Nick Iliev
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Niklas
Top achievements
Rank 1
answered on 12 Oct 2020, 06:16 PM

Hi and thank you for your reply, with this I was able get things working with the emulator. It turned out I had two different problems. First is that the Fiddler setting "Decrypt HTTPS traffic" must be set to "... from all processes", I had it set to remote clients only. The second is about how you set up the proxy. When using Android Studio it's possible to set up which proxy to use from the emulator settings as well as inside Android. The emulator settings is very convenient, but this does not seem to work at all with Fiddler (it works fine with other proxies like Burp suite or mitmproxy).

In case others have the same problems as me, here's what I did to get Fiddler working with emulators.

In Fiddler:
* Make sure the "Decrypt HTTPS traffic" is set to "...from all processes".
* If you need to change this setting, make sure to restart Fiddler after saving the settings.
* Make sure that the fiddler certificate is installed on the device.

If using Genymotion:
* Set up the wifi to connect to the Fiddler proxy following the steps in the post linked by Nick.
* Use either 10.0.3.2 or your ip on the local network (192.168.xxx.yyy), both worked fine for me.

When using the Android Studio Emulator it might be possible to modify wifi settings in the same way as with Genymotion but using 10.0.2.2. However I didn't get it working and when testing with Android 5 as I'm doing there is no WIFI available. So this is what I did to get it working with the Android Studio emulator:

* DO NOT use the proxy settings found under Settings -> Proxy in the emulator, this does not work with Fiddler for https traffic (http traffic works fine).
* Inside Android, open Settings -> More... -> Cellular networks -> Access Point Names -> Press + to add a new name (or edit the default if possible)
* Provide any value under Name and APN. Input your local network IP or 10.0.2.2 under Proxy and specify the fiddler port under port.
* Tap the three dot meny and save.
* Go back to the APN list and make sure your apn is selected (tap the radio button to select it)
* Turn on flight mode and then disable it again to enable the new settings

0
Nick Iliev
Telerik team
answered on 14 Oct 2020, 08:29 AM

Hello Niklas,

 

Glad to hear that you could resolve the issue, and thank you for providing the additional details!

I will add some of the KB article observations so that more users are aware that the proxy settings on the emulator should be made through the emulated Android OS (and not through the Android Studio settings or the AVD settings).

 

Regards,
Nick Iliev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Mobile
Asked by
Niklas
Top achievements
Rank 1
Answers by
Nick Iliev
Telerik team
Niklas
Top achievements
Rank 1
Share this question
or