On the emulator, you can use the below command to install the certificate. You must have openssl
installed and available on the terminal.
-
Start the emulator with the below command
emulator -avd <adv_name> -writable-system -wipe-data
-
Run below commands to download and install the certificate
# This script does not work on Android 14 and real devices curl -o $PWD/ca.pem https://raw.githubusercontent.com/AppiumTestDistribution/appium-interceptor-plugin/master/certificate/certs/ca.pem file=$PWD/ca.pem filename=$(openssl x509 -noout -subject_hash_old -in $file) openssl x509 -in $file > $filename.0 openssl x509 -in $file -text -fingerprint -noout >> $filename.0 adb root adb remount adb reboot adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;' adb root adb remount adb push $filename.0 /system/etc/security/cacerts adb remount
-
Open
Settings
>Security settings
>Encryption and Credentials
>Encryption and Credentials
. -
Ensure the installed certificate is displayed under the
System
section of theTrusted Credentials
settings.
NOTE: If you save the emulator snapshot you don't need to add -writable-system -wipe-data
when you start the emulator from the snapshot. -writable-system -wipe-data
is required only once.
-
Download the
ca.pem
file from here and save it to the computer. -
Push the downloaded certificate to the devices manually or via abd push command as below
adb push downloaded_cert_path/ca.pem /storage/emulated/0/Download
The above command will push the certificate to the download directory of the Android device.
-
Open
Settings
>Security settings
>Encryption and Credentials
>Install a certificate
>CA Certificate
>Install anyway
and choose theca.pem
file and install the certificate. -
Ensure the installed certificate is displayed under the
User
section of theTrusted Credentials
settings.
-
Install the plugin by running the command
appium plugin install --source=npm appium-interceptor
-
To Make sure your setup is working connect your Android device/emulator to your machine and run the below command
appium plugin run appium-interceptor test-connection
A new browser session will be started on the mobile and you should see the below page opened
If you see any errors then please first retry the steps. If it doesn't work please raise an issue with the screenshot and logs and we will investigate it.