Setting a Proxy in Android

I use Charles proxy to debug my network traffic. This requires setting the device or emulator proxy to point to my local ip address where Charles is running. Charles can then intercept the device’s network traffic. This post outlines how to set the proxy for android devices and emulators.

Android Devices

Go to your wifi settings and long tap on your wifi network until you see a menu.

  • Select Modify Network
  • Tap Advanced Options
  • Select Manual under Proxy
  • Enter your local ip and the proxy port
  • Select Save

Genymotion Emulators

The process for Genymotion emulators is the same as the steps above for real devices, with one handy variation. If you use for the ip address, this will automagically refer to your computer’s local ip. This means that you won’t need to update it when your ip address changes e.g when you decide to work from a cafe for a couple of hours.

Android Emulators

The proxy for Android emulators can be set from the command line with the following argument:

-http-proxy http://<local-ip-address>:<port>

There used to be a setting for adding command line options in Android Studio but this has disappeared. You can still run the option when launching the emulator from the command line.

Start by listing your emulators to find the name of the one you want to launch:

 android list avd 

Now launch the emulator

emulator -avd <name> -http-proxy http://<local-ip-address>:<port>

1 thought on “Setting a Proxy in Android

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s