Search code examples
androidproxyadbhttp-proxy

Remove the global http_proxy without rebooting the Android device


I use the following code to set up Android HTTP proxy via command-line tool adb.

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

However, when I want to undo the proxy settings, the following code does not remove the proxy. Although it clears those system attributes, the Android device still tries to connect <ip>:<port>

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

I have to reboot the Android device to remove the proxy. Is there an approach to clean the proxy without rebooting the device?

The Android version is 7.0.

To reproduce this problem:

# Set up a proxy
adb shell settings put global http_proxy <ip>:<port>

# Remove them
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

# Then open a browser, it will still connect to the proxy ip and port

Solution

  • Do:

    ~$ adb shell settings put global http_proxy :0