When working with Android apps, debugging HTTP Requests can be a challenge. Requestly provides an easy-to-use solution for everyone who needs to monitor, modify, or debug HTTP requests and responses during development or QA testing. This section outlines step-by-step instructions, guiding you on how to set up Requestly for your Android emulator.
By the end of this guide, you will have a fully functional interception setup tailored for your Android development needs.
Step-by-Step Guide
Video Guide
For a visual walkthrough, check out our YouTube video guide:
Automatic Setup
Requestly offers a one-click setup for Android emulators using Desktop App version 1.7.0+. Here's how:
Start Your Android Emulator
Ensure your emulator is up and running before proceeding
Open Requestly Desktop App
Launch the Requestly desktop application on your computer.
Click any one of the Connect Apps buttons from the network table as shown below
Here go to Mobiles apps and you should be able to see all Android emulators running on your device simply click on connect
Manual Setup
If the automatic setup does not work for you, you can manually configure the proxy by following these steps:
If you have ADB installed, you can skip the proxy setup through the emulator's UI by running the following command in your android studio terminal:
adb shell settings put global http_proxy "<ip>:<port>"
Make sure to change the : in the above command to the one mentioned in the header of Requestly desktop app
Otherwise, follow these steps to configure the proxy manually:
Select Network:
Tap on Internet and click on gear icon on connected network name to open its settings.
Modify Network Settings:
-
At the top right of screen click the edit icon
-
Enable "Advanced Options" if needed.
-
Set the Proxy to "Manual."
Enter Proxy Details, input the following:
-
Proxy Hostname: Use the IP shown in the Requestly Desktop App (e.g.,
192.168.1.10
). -
Proxy Port: Use the port displayed in the Requestly Desktop App (e.g.,
8080
).
Save Changes
Apply the settings and continue with certificate installation
CA Certificate Installation
To intercept HTTPS traffic, you need to install Requestly's root CA certificate on the emulator. You can do this in two ways:
Option 1: From the Desktop:
Download the certificate from Requestly’’s Desktop app
-
Open the Requestly Desktop App.
-
Navigate to Connect Apps > Others > Manual Setup > Save Certificate to download the root CA certificate.
Install the Certificate
After the certificate is downloaded on your PC, Run this script in android studio to push it to the emulator using the following script:
#!/bin/bash
subjectHash=`openssl x509 -inform PEM -subject_hash_old -in **<certificate-path>** | head -n 1`
openssl x509 -in **<certificate-path>** -inform PEM -outform DER -out $subjectHash.0
adb root
adb push ./$subjectHash.0 /data/misc/user/0/cacerts-added/$subjectHash.0
adb shell "su 0 chmod 644 /data/misc/user/0/cacerts-added/$subjectHash.0"
adb reboot
Replace <certificate-path> with the path to the downloaded certificate
Option 2: Directly on the Emulator:
Download certificate
-
Open Chrome in an incognito tab
-
Go to http://requestly.io/ssl (⚠️ Use http here, not https)
-
This will download RQProxyCA.pem.cert
Install CA Certificate
-
Go to Settings > Search "CA Certificate" > Install Anyway.
-
Select the downloaded certificate and install it.
Verify Installation:
After installation, confirm your setup by going to amiusing.requestly.io
SSL Pinning [if-required]
From Android API level 23 (Android 6.0+), many apps enforce SSL pinning for security. To intercept HTTPS traffic, setting up SSL pinning is required.
Make sure to remove these in production builds
Add these configs to your app codebase for it to work
Step 1: Add res/xml/network_security_config.xml
<network-security-config>
<debug-overrides>
<trust-anchors>
<certificates src="user" />
<certificates src="system" />
</trust-anchors>
</debug-overrides>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>
Step 2: Add to AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
<application android:networkSecurityConfig="@xml/network_security_config" ... >
...
</application>
</manifest>
Deactivate Proxy (After done debugging)
Please make sure to revert the proxy after you are done testing using Requestly
adb shell settings put global http_proxy :0
Troubleshooting
Emulator not detected?
-
Check if your emulator is running?
-
Check if
adb
is installed. If not, install it from here -
Try Restarting your emulator.
How does it work?
Here's the code that makes this happen in a single click
-
Searches for online ADB devices
-
On
Connect
-
Root the device (To install Requestly CA)
-
Inject Requestly CA (if not already)
-
Setup Proxy on Emulator
-
Restart the Emulator (Only first time)
-
-
On
Disconnect
- Removes the Proxy