Android emulator proxy: -http-proxy, adb and authentication

Route the Android emulator through a proxy: -http-proxy with a login, adb global http_proxy, DNS that skips the tunnel, and how to check the exit.

The Android emulator as a glass phone with its side toolbar, the Android mark and Pixel_8_API_35 on the screen, reading emulator proxy, every TCP connection, login in the URL. A silver monitor shows the launch command emulator @Pixel_8_API_35 -http-proxy http://USER:PASS@HOST:PORT, wired into the phone, and the phone is wired to a graphite proxy unit at HOST:PORT. Two labels name the traps: system proxy, no login field: 407; DNS and UDP go around the tunnel.
Quick summary · TL;DR
  1. Use -http-proxy when the proxy has a login. Start the device with emulator @AVD -http-proxy http://USERNAME:PASSWORD@HOST:PORT. It is the only documented emulator route that takes credentials, and it tunnels every TCP connection, so apps cannot skip it.
  2. The system proxy has no password field. Set through Wi-Fi or adb shell settings put global http_proxy, it is fine for Charles or mitmproxy on 10.0.2.2, but a login proxy there gives you 407s in apps while Chrome happily prompts.
  3. DNS and UDP go around the tunnel. Lookups go to 10.0.2.3 and out through your own resolver, and QUIC is UDP, which the emulator proxy does not redirect. A -tcpdump capture shows you exactly what slipped past.
  4. Check the exit inside the app, not just Chrome. Call the same IP echo endpoint from your debug build and compare. If the two disagree, the app is not on the route you think it is.

An Android emulator proxy can live in two places. The emulator proxy takes -http-proxy http://USERNAME:PASSWORD@HOST:PORT at launch, or a manual entry in Extended Controls, and tunnels every TCP connection from the virtual device. The Android system proxy sits in the Wi-Fi settings or in adb shell settings put global http_proxy, carries no login, and covers only the apps that read it.

You usually find this out the hard way. Chrome inside the emulator shows the exit country you paid for, while the app under test still loads your home storefront. Or every request from the app comes back as a 407 and the Wi-Fi dialog has nowhere to type a password.

Only the emulator proxy carries a login. DNS and UDP enter neither route. And Chrome showing the right country proves nothing about the app under test, so the check has to run inside the app too.

Two Android emulator proxy routes

Google’s emulator proxy guide (updated 12 March 2026) describes both routes and says they are mutually exclusive: only one can be on at a time. That split matters more than the docs make it sound, because each route is built for a different job.

The emulator proxy. It runs in the emulator process on your machine, outside Android. Every TCP connection the virtual device opens is forwarded through the HTTP proxy you name, so apps cannot opt out of it. It takes a username and password, but it cannot decrypt HTTPS, has no bypass list and does not redirect UDP.

The Android system proxy. It runs inside Android, the same setting a real phone has on its Wi-Fi network. Browsers and most apps read it, some ignore it, and it is the route debugging tools like Charles or mitmproxy expect, because the app talks to the inspector directly.

Google’s comparison table labels the system proxy “Network Layer” and the emulator proxy “Application Layer”, while the text underneath says the opposite, which trips up anyone skimming. Trust the text; the emulator proxy is the lower one.

Start the emulator with -http-proxy

For a remote proxy with a login, this is the route to use. List your virtual devices, then start one with the proxy URL:

emulator -list-avds
emulator @Pixel_8_API_35 -http-proxy http://USERNAME:PASSWORD@HOST:PORT

The emulator command-line reference (updated 5 October 2026) accepts http://server:port or http://username:password@server:port, and the http:// prefix can be left off. Three details from the same page save time:

  • The environment variable works too. Without the flag, the emulator reads http_proxy at startup and uses it if the value matches the same format. Handy in CI, easy to forget on a laptop where a stale http_proxy from another project is still exported.
  • Several emulators read it once. With more than one emulator running, set the flag on the first launch.
  • Android Studio fills it in. Launched from the IDE, the emulator copies the IDE’s proxy settings (Settings, Appearance & Behavior, System Settings, HTTP Proxy) into the emulator proxy one time. Those settings never touch the Android system proxy.

Google lists only http:// forms and says nothing about SOCKS, so give the emulator the provider’s HTTP endpoint. proxymint includes HTTP and SOCKS5 on every tier, and the HTTP one is the one to paste here. HTTPS apps still work: the emulator opens a tunnel and TLS runs end to end between the app and the site.

Extended Controls instead of the flag

Open the emulator’s Extended Controls (the three dots on the side toolbar), then Settings and the Proxy tab. By default it uses Android Studio’s HTTP proxy settings; switch to a manual configuration to enter a host and port. Google’s page notes that the emulator saves this per device and restores it on restart, and that a change only applies after a restart. If nothing seems to happen, that restart is usually what is missing.

For a login, the documented Android emulator proxy route is still the flag or the variable. Keep the credentials in a launch script rather than retyping them into a dialog for every device.

Proxy authentication in the emulator

Credentials go inside the proxy URL, so any @, : or / in the username or password has to be percent-encoded first, or the emulator cannot parse the URL and never reaches the proxy. @ becomes %40, : becomes %3A, / becomes %2F. One line encodes a value without guessing:

python3 -c "import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1], safe=''))" 'PASSWORD'

Android’s system proxy has no login field at all, whether you set it in the Wi-Fi dialog or with adb. Point it at a proxy that requires a password and Chrome may pop a login prompt, while apps get a 407 Proxy Authentication Required and fail, often with a generic network error that never mentions the proxy. That is the most common dead end in emulator testing, and the fix is to move the login proxy to -http-proxy.

proxymint authenticates with a username and password on every tier, which makes the emulator proxy the natural fit for its exits.

adb shell settings put global http_proxy

For the system proxy on a running emulator, adb is faster than tapping through the Wi-Fi screen. That value lives in Android’s global settings, which the platform’s Wi-Fi proxy uses:

# set it (host:port, no scheme, no login)
adb shell settings put global http_proxy 10.0.2.2:8080

# read it back
adb shell settings get global http_proxy

# clear it
adb shell settings put global http_proxy :0

# target one emulator when several are running
adb -s emulator-5554 shell settings put global http_proxy 10.0.2.2:8080

10.0.2.2 is the emulator’s alias for your machine’s loopback, per Google’s network address table (updated 12 March 2026). Use it when the proxy is a tool on your own machine; 127.0.0.1 inside the emulator is the virtual device itself, which is a mistake almost everyone makes once.

The rule flips for the emulator proxy. -http-proxy and Extended Controls are read by the emulator process on your machine, so there 127.0.0.1 does mean your machine, which is why Charles guides that use Extended Controls enter 127.0.0.1 and guides that use the Wi-Fi or APN settings enter 10.0.2.2. Both are right for their route. The emulated cellular connection has its own proxy field too, under Mobile network, Access point names, and it takes the same 10.0.2.2 address.

Clear it when you are done. The setting survives a restart, so the next time the inspector on your machine is closed, every app in the emulator loses its connection and nothing on screen says why.

Some apps read the proxy once and keep it. After a change, force-stop the app under test with adb shell am force-stop PACKAGE before you judge the result. And if the emulator proxy is also on, clear one of them: the two are not designed to run together.

Verify the exit from inside the app

A check that stops at the browser proves only that Chrome uses the Android emulator proxy. Run it in this order:

  1. On the host. Before you launch anything, test the same proxy URL with curl: curl -x http://USERNAME:PASSWORD@HOST:PORT https://ipinfo.io/json. If this fails, the emulator never had a chance. Any endpoint that returns the caller’s IP and country works; ipinfo.io is one example. Test with an https:// URL, because some gateways answer plain http:// with a redirect.
  2. In Chrome on the emulator. Load the same endpoint and read the country and the network name. A mobile exit usually shows a mobile carrier network, a residential exit a home ISP.
  3. In the app. Call the same endpoint from a debug menu in your own build, or log it with an HTTP logging interceptor and read it in Logcat. If Chrome and the app disagree, the app is not using the route you set.
  4. Around the IP. A proxy changes the address and nothing else. By default the emulator uses your machine’s time zone; start it with -timezone Europe/Berlin (any zoneinfo name) to match the exit, and set the device language in Settings. An exit in Germany with a device clock in California is the kind of mismatch a geo test should catch, not create.

DNS and UDP skip the tunnel

An Android emulator proxy forwards TCP. DNS is a UDP lookup, sent inside the emulator to 10.0.2.3, the virtual router’s DNS server, which by default forwards to the resolvers your own machine uses. So every hostname the app resolves is looked up from your network, before the TCP connection ever reaches the proxy.

In practice the proxy receives a connection to an IP address that was chosen for your location. For most sites that is harmless, because the content is decided by the exit IP that arrives at the server. For services that steer users by DNS, it can route a test to an edge near your desk instead of near the exit. And your local network sees every hostname the app asks for, which is the same leak covered in proxy DNS leaks.

A -dns-server flag changes which resolver the emulator uses, up to four of them. It does not change where the query leaves from.

UDP traffic in general follows the same rule, which catches people out. HTTP/3 runs on QUIC, which runs on UDP, and the emulator proxy does not redirect UDP. Treat any UDP the app sends as leaving from your own network unless a capture proves otherwise. Starting the emulator with -tcpdump /path/capture.pcap records every packet on the virtual LAN, and filtering it in Wireshark for UDP ports 53 and 443 shows what went around the tunnel.

Inspect traffic, chain a remote proxy

Debugging tools work on the system proxy route, because the inspector has to terminate TLS. Start Charles, mitmproxy or Burp on your machine, point the system proxy at 10.0.2.2 and the tool’s port (mitmproxy listens on 8080 by default, Charles on 8888), and install the tool’s CA certificate on the emulator. The usual way is to open the tool’s certificate page in the emulator’s browser (mitm.it for mitmproxy, chls.pro/ssl for Charles) while the proxy is on, then install the downloaded file as a CA certificate from the Security settings.

Most setups stall at the certificate. Per Android’s network security configuration docs (updated 28 August 2026), apps that target Android 7.0 (API 24) or higher trust only the system CA store by default, so a certificate you install as a user does nothing for them. For your own app, add a debug-overrides block. It applies only when the build is debuggable, so a release build never trusts your inspector:

<network-security-config>
    <debug-overrides>
        <trust-anchors>
            <certificates src="user" />
        </trust-anchors>
    </debug-overrides>
</network-security-config>

Save it as res/xml/network_security_config.xml and reference it from the <application> element in the manifest with android:networkSecurityConfig="@xml/network_security_config". Apps you did not build are a different problem: their trust store is the system one, and changing it means a rooted or writable system image, which is out of scope for a proxy setup.

The two emulator proxy routes are mutually exclusive, so the inspector and a remote login proxy cannot both be the emulator’s proxy. Chain them instead: the emulator talks to the inspector, and the inspector forwards to the remote proxy with the login. In mitmproxy that is upstream mode:

mitmproxy --mode upstream:http://HOST:PORT --upstream-auth USERNAME:PASSWORD

Charles does the same under External Proxy Settings, with an authentication option per proxy. Your app sees the inspector’s certificate, the inspector sees cleartext, and the target sees the remote exit.

Which exit fits the test

Your emulator settings decide how traffic leaves your machine. The proxy type decides what the target sees.

  • Carrier origin. When the app or service behaves differently on cellular networks, such as mobile-first platforms, carrier-specific content or mobile ad creatives, the test needs an exit on a carrier network. mobile proxies give you that, with country, region and city chosen on the order. The mobile proxy explainer covers why carrier addresses are shared through CGNAT and what that means for a test.
  • Regional storefronts and web views. When the question is “what does a shopper in Lyon see”, a home ISP exit does the job, and rotating residential proxies cover more locations for that kind of browsing check.
  • Plain connectivity. CI jobs that only need to reach an API from another country, or to get out of a locked-down office network, need a stable route more than a consumer address. Datacenter proxies fit that job.

Pick the rotation with the test in mind. A new IP on every request breaks any flow with a login or a cart halfway through, so a timer of 5 to 60 minutes, or sticky while the device stays online, fits app sessions better. On proxymint that is set on the order and can be changed later with the same credentials.

Setting Extended Controls, Cellular, Network type to LTE or 5G only throttles the emulator’s speed and latency, a detail that fools people into thinking the test ran on a carrier. Traffic still leaves through your own connection or your proxy.

Android emulator proxy not working

SymptomLikely causeFix
Apps fail, Chrome asks for a loginA login proxy set as the system proxyMove it to -http-proxy with the credentials in the URL
No network at all after launchWrong host or port, or an unencoded @ or : in the passwordTest the URL with curl on the host, percent-encode the password
Chrome shows the exit, the app shows homeThe app ignores the system proxy, or sends QUIC over UDPUse the emulator proxy, then capture with -tcpdump
No internet after closing Charles or mitmproxyThe adb global proxy still points at 10.0.2.2adb shell settings put global http_proxy :0
A proxy change does nothingExtended Controls changes need a restart, or the app cached the old valueRestart the emulator, force-stop the app
HTTPS errors after installing a CAThe app targets API 24+ and ignores user CAsAdd debug-overrides to your debug build
The second emulator ignores the proxyThe flag was not set on the first launchSet it on the first emulator you start
Right IP, wrong country contentTime zone, locale or DNS still point at your locationUse -timezone, set the locale, check DNS in a capture

Pick the route, then the exit

If the proxy needs a username and password, start the emulator with -http-proxy and leave the system proxy empty. If you need to read the traffic, set the system proxy to your inspector on 10.0.2.2, trust its CA in a debug build, and chain the remote proxy behind it. In both cases, confirm the exit from inside the app, not only in Chrome, and capture once to see what UDP left on its own.

Then choose the exit by what the target checks: a carrier network for app-first services and mobile ads, a home ISP for regional storefronts, a stable route for CI connectivity. Run the four-step exit check once per exit type before you trust a geo result from the Android emulator proxy.

Frequently asked questions

Start it from the command line with emulator @AVD_NAME -http-proxy http://HOST:PORT, or open Extended Controls, Settings, Proxy and enter a manual configuration, then restart the emulator. That is the emulator proxy, which tunnels all TCP traffic. The other option is the Android system proxy in the Wi-Fi settings, which only covers apps that read it.

Put the credentials in the proxy URL: emulator @AVD_NAME -http-proxy http://USERNAME:PASSWORD@HOST:PORT. Percent-encode any @, : or / in the username or password first. The Android system proxy has no login field, so a proxy that needs a password belongs on the emulator proxy.

Run adb shell settings put global http_proxy HOST:PORT against the running emulator, and add -s emulator-5554 when more than one is running. This sets the Android system proxy, without a login. Read it back with adb shell settings get global http_proxy, and force-stop the app under test so it picks up the change.

For the system proxy, run adb shell settings put global http_proxy :0 or clear it in the Wi-Fi settings. For the emulator proxy, start the emulator without the -http-proxy flag, unset any http_proxy variable in your shell, and switch Extended Controls back from the manual configuration, then restart.

Google's emulator documentation lists only HTTP proxy forms for -http-proxy and the http_proxy variable and does not mention SOCKS. Use the provider's HTTP endpoint for the emulator. HTTPS apps still work, because the emulator tunnels the connection and TLS runs end to end.

Usually the proxy is set as the Android system proxy, which some apps do not read, or the app sends HTTP/3 over UDP, which neither route redirects. The emulator proxy covers every TCP connection, so move the setting there. If the app still shows your own location, capture traffic with -tcpdump and look for UDP.

Open an IP echo page such as ipinfo.io in Chrome on the emulator and read the IP, country and network name. Then call the same endpoint from inside the app under test, for example from a debug menu, since the browser and the app can take different routes. Test the proxy URL with curl on your own machine first.

Researched and drafted with AI tools, then checked against our publishing rules before it went live: 4 outside links, 6 links to other proxymint pages, no prices and a fact-check pass against our product records. How we write.