一、使用全局命令
设置代理:
adb shell settings put global http_proxy 代理IP地址:端口号
如:
adb shell settings put global http_proxy 127.0.0.1:8888
移除代理:
adb shell settings delete global http_proxy
adb shell settings delete global global_http_proxy_host
adb shell settings delete global global_http_proxy_port
adb reboot
二、使用第三方apk
AndroidProxySetter工具可以帮助我们使用adb命令可以快速进行wifi代理的设置和清除
GitHub地址:https://github.com/jpkrause/AndroidProxySetter
下好apk后,安装到手机adb install proxy-setter-debug-0.2.1.apk
设置代理:
adb shell am start -n tk.elevenk.proxysetter/.MainActivity -e host 代理IP地址 -e port 端口号 -e ssid WIFI名称 -e reset-wifi true -e key WIFI密码
如:
adb shell am start -n tk.elevenk.proxysetter/.MainActivity -e host 127.0.0.1 -e port 8888 -e ssid YOUR-WIFI-NAME -e reset-wifi true -e key YOUR-WIFI-PASSWORD
http://tao93.top/2018/11/01/%E4%B8%80%E9%94%AE%E8%AE%BE%E7%BD%AE%20Android%20http%20proxy%20%E7%9A%84%E5%B0%9D%E8%AF%95/
https://www.cnblogs.com/saryli/p/9764447.html