设置代理:
adb shell settings put global http_proxy ip:port
如:
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
但是,adb shell settings delete global http_proxy,再有些没有delete参数的设备上报错?
Invalid command: delete
usage: settings [--user NUM] get namespace key
settings [--user NUM] put namespace key value
'namespace' is one of {system, secure, global}, case-insensitive
If '--user NUM' is not given, the operations are performed on the owner user.
解决方法,sqlite中找到settings.db,在数据库中删除代理信息(需要Root)
sqlite3 /data/data/com.android.providers.settings/databases/settings.db
sqlite> select * from global;
sqlite> delete from global where name="global_http_proxy_host";
sqlite> delete from global where name="global_http_proxy_port";
sqlite> delete from global where name="http_proxy";
然后重启设备:reboot