使用命令行启动 avd 后更改 Android 模拟器 http 代理

Change Android emulator http proxy AFTER launching avd with command line

如何即时更改模拟器代理?我知道我可以在启动模拟器时使用 -http-proxy 参数来定义代理服务器(或使用 http_proxy 环境变量),但我想更改已启动和 运行 模拟器的代理服务器 从命令行.

AVD 选项面板 (Extended Controls) 可以动态定义 http 代理。

所以问题是"What is the command line way to do so"?

您可以使用下一个命令设置 HTTP_PROXY 全局设置:

adb shell settings put global http_proxy <ip>:<port>

您可以使用 adb shell settings put global http_proxy <ip>:<port>。但请记住,它仅在您的应用程序未指定代理时才有效。(无代理等)