Capture traffic from Android Emulator using Fiddler

Welcome to Performance Testing Gyaan😀

In this blog post I will show the steps you can take to capture network traffic from Android Virtual Device using fiddler.

I have tested on below versions of the software, but it should work fine for later versions as well.

Fiddler version - 5.0
Android Studio version - 4.0
Android Virtual Device (Pixel 2) target API - 28 (Android 9.0)
OS - Windows 10

Steps:
  1. Open fiddler. Navigate to Tools > Options from the menu bar.

  2. Switch to HTTPS tab and select check boxes as shown in the image below

    HTTPS Tab

  3. Add fiddler root certificate to trusted list. Also export the certificate to Desktop. This will later be copied onto the virtual device for installation.

  4. Switch to Connections tab and select check boxes as shown in the image below. Make sure to check Allow remote computers to connect

    Connections Tab

  5. Close Fiddler for now.

  6. Open Android Virtual Device (AVD) from Android Studio.

  7. Open Settings and Navigate to Network and Internet. Turn Wi-Fi Off.

    Network and Internet Settings

  8. Navigate to Mobile network>Access Point Names and you should see one APN already created there. Click on plus (+) sign to add new APN

    APN Home

  9. Edit fields as below and Save

    Name- Internet
    APN- Internet
    Proxy- your local IP address (you can find this by running ipconfig command on command prompt. You can also see this in fiddle when you hover on Online tab which is located on top right corner in fiddler)
    Port- 8888 (Same as configured in fiddler)

    Leave all other fields with default values and Save the new access point.

    Edit access point

    Online Icon in Fiddler. Hover over it to see your IP address

  10. Select the APN with name Internet.

    Select APN

  11. Now you need to copy the fiddler root certificate (exported on your desktop) on your AVD (Android Virtual Device). To do this simply drag the file on AVD. Next step is to install the certificate.

  12. Navigate to Settings>Security & Location>Encryption & Credentials> Install from SD Card
    Then from menu options go to Downloads folder where you will find the certificate. Click on the certificate. A window prompts you to enter name for the certificate. Give any name like Fiddler root and click OK. Then it may ask to set up PIN lock on the device. Complete the set up. You can check if certificate is added by navigating under Trusted Credentials>User.



    Navigate to Downloads Folder

    Install certificate

    Hurray!😀 You are now completed with configurations. Open Fiddler and navigate from the app for which you want to monitor the traffic. You should see the requests in fiddler now.

Comments

Popular posts from this blog

Parameterization and Correlation (Load Runner, Jmeter and VSTS)

Introduction to Performance Testing Basics