You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何通过命令行修改已启动Android模拟器的HTTP代理?

How to Dynamically Set Proxy on a Running Android Emulator via Command Line

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
    Run adb devices to check that your emulator appears in the list (it’ll look like emulator-5554). If multiple emulators are running, target the specific one with the -s flag, e.g., adb -s emulator-5554 shell.

  • Set the HTTP/HTTPS proxy
    Use Android’s built-in settings command 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.100 on port 8080, run:

    adb shell settings put global http_proxy 192.168.1.100:8080
    

    This 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 the bypass_proxy property:

    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

火山引擎 最新活动