如何通过命令行修改已启动Android模拟器的HTTP代理?
Great question! You're right that the Extended Controls panel lets you tweak proxy settings on a running emulator, and you can replicate that exact functionality via the command line using adb (Android Debug Bridge). Here's a step-by-step breakdown:
First, confirm your emulator is connected to adb
Runadb devicesto check that your emulator appears in the list (it’ll look likeemulator-5554). If multiple emulators are running, target the specific one with the-sflag, e.g.,adb -s emulator-5554 shell.Set the HTTP/HTTPS proxy
Use Android’s built-insettingscommand to modify the global proxy configuration directly on the emulator:adb shell settings put global http_proxy <proxy-host>:<proxy-port>For example, if your proxy is at
192.168.1.100on port8080, run:adb shell settings put global http_proxy 192.168.1.100:8080This works for both HTTP and HTTPS traffic, just like the Extended Controls panel does.
Add proxy bypass rules (optional)
If you want certain domains to skip the proxy (e.g., local services), set thebypass_proxyproperty:adb shell settings put global bypass_proxy "localhost,127.0.0.1,*.your-local-domain.com"Separate multiple entries with commas.
Disable the proxy
To clear proxy settings entirely, run:adb shell settings put global http_proxy ""Or delete the property outright:
adb shell settings delete global http_proxy
A quick note: Some apps cache proxy settings, so you may need to restart the app (or the emulator, if necessary) for changes to take full effect. Since emulators run with root privileges by default, you won’t hit permission issues with these commands.
内容的提问来源于stack exchange,提问作者Sepehr Behroozi




