Map Remote Charles with Android device

The tutorial shows how to map an API endpoint response with a JSON file. This is good for testing API endpoint response and for faster prototyping.

Tools require:

Android Studio — to run Android emulator

Charles — Map response API to a JSON file

Setup Charles to connect with your Android device

  1. Charles -> Proxy -> Enable SSL Proxying (now we can see network responses)

1. Go to the Android device’s wifi settings.

2. Select “Modify network” and select “advanced options”.

3. In the menu setting “Proxy” (select manual).

4. In the menu setting “Proxy hostname” enter your laptop’s IP address 192.xx.xx.xx. Get your laptop’s IP from Charles, open Charles, go to Help, Local IP address.

5. In the menu setting “Proxy Port” enter 8888.

6. Charles console now you can see the Android devices network logs.

Open Charles, go to Help -> SSL Proxying -> Install Charles Root Certificate on a Mobile Device or Remote Browser

  1. Setup an Android device with Charles: change wifi settings to use “Manual Proxy”, point to your local IP (steps above).
  2. On Android device go to chls.pro/ssl and install the cert. Name the downloaded cert and select ‘VPN and apps”.
  1. Open Charles, go to Proxy -> SSL Proxying Settings -> click “Add”

Enter:

*.*

Click ok.

Change API response endpoint with the JSON file.

  1. Get the API’s endpoint URL.
  2. Open Charles. (read above to setup Charles).
  3. Charles -> Tools -> Map Local.
  4. Fill Host (API endpoint URL) click enter (it will autofill the path and query).
  5. Now choose the path to the downloaded JSON, click ok.

It will reroute home API endpoint response to the content of the JSON file :)

Thanks for reading and let me know if I’m wrong somewhere or if there’s something that could do differently or better. I’m open to your feedback 🙌🏻

-Andres

software engineer, read, swim, travel. apps: https://goo.gl/rDuuQw https://goo.gl/15GvfE

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store