Android - How can I flush the DNS Cache?

Addresses are cached for 600 seconds (10 minutes) by default. Failed lookups are cached for 10 seconds. From everything I've seen, there's nothing built in to flush the cache. This is apparently a reported bug in Android because of the way it stores DNS cache. Clearing the browser cache doesn't touch the DNS, the "hard reset" clears it because it simply times out.

Can we ask the underlying reason for needing to clear the DNS cache? Perhaps there's another solution that's missed because we're not looking at the bigger picture.


On a typical Linux system the cache is cleared by running /etc/init.d/nscd restart, but at least my ROM doesn't use nscd to cache DNS. You can check if yours does, but I doubt it. I've seen suggestions that clearing the brower cache would clear DNS cache too, but one sure way is to do a hard reboot (shutdown, remove battery for 30s, reattach battery and boot).


The only way to do this in Android is to do a hard reboot. The necessary command-line tools are not normally available, however in my tests a hard reboot has always done the trick for me (Galaxy Nexus, and HTC Desire, various ROMs).

This is a pain, but it is quicker than the 10min cache timeout.