Recording Mobile Apps on the Android Emulator with Silk Performer
This article guides you through the configuration of Silk Performer to record network traffic of mobile apps on the Android emulator via proxy recording.
Before you start:
- Install the Android SDK (http://developer.android.com/sdk/installing.html)
- Download Android SDK packages from Android Studio.
If you don’t know which packages are required for the Android SDK, take a look at the following screenshots (SDK Platform and SDK Tools). The workflow for this article was created with an emulator running Android 7.1.1 API Level 25.
If you already have a configured environment that allows you to run Android apps in the emulator, you can skip step 1.
1. The Android Virtual Device (AVD)
To run your application in the Android Emulator you need an Android Virtual Device. If you have not set one up yet, open the Android Virtual Device Manager and add a new AVD.
Android Virtual Device Manager:
Android Virtual Device detail:
In this case, we opted for Cold Boot to ensure all traffic is captured from the start.
2. Configure the emulator APN to use the Recorder as a proxy
On the emulator, go to:
SETTINGS | MORE… | CELLULAR NETWORKS | ACCESS POINT NAMES.
Select an existing APN for editing, as shown below. Then edit Proxy and Port to specify the IP address of the Recorder machine and the port it is listening to. Example:
Tip: remember to save these settings before leaving the screen.
3. Create an Android Emulator Application Profile
Let us create a new Application Profile for the Android Emulator. In Silk Performer, click SYSTEM SETTINGS | RECORDER | APPLICATION PROFILES and click the ADD… button.
Enter the following information:
- Application profile name (e.g. Android Emulator)
- Application path (e.g. C:\Program Files (x86)\Android\android-sdk\tools\emulator.exe)
- Working directory (e.g. C:\Program Files (x86)\Android\android-sdk\tools\)
- Program arguments: leave this field blank.
In the Protocol selection area, check the Web check box, then click the Web Settings… button and select Proxy – Manual browser configuration on the Web Settings dialog.
Start with a new Mobile Devices project.
Start the Recorder from the main menu: RECORD | RECORDER.
Now start the Android emulator from the AVD Manager.
If you start the emulator from command line, do not use –http-proxy as the proxy is known to work with APN configuration at this time.
Open an application such as Chrome and navigate to the website you want to record.
The Recorder should show traffic being captured. Click its window title and press CTRL+Z to expand the logs area:
If no traffic is captured, try disabling the virtual wi-fi so to use the mobile connection only.
In this case, we had Microfocus CA installed on the emulator, which is necessary to record secure traffic (https). If you require recording secure traffic, let us take a step back and install the certificate on the emulator.
5. Installing Silk Performer certificate (Microfocus CA) on the Android system
First, go to Silk Performer Workbench and click Model Script on the workflow bar:
Select Record via mobile device.
In the following screen, choose Install Micro Focus CA and start recording:
Now use a browser such as Chrome and point it to the address shown in the following screen:
In the emulator, confirm that you want to install the certificate and confirm any security requirements. Choose to install the certificate for VPN and apps when prompted.
To verify that the certificate is correctly installed, go to:
SETTINGS | SECURITY | TRUSTED CREDENTIALS | USER, as shown below:
Alternatively, if you have Google Drive on the emulator, copy the certificate from Silk Performer root folder and click on it. This will trigger the installation of the certificate and any required security settings by Android.