It depends on the version of Android.
If you have an Internet connection and that your application states that it needs Internet access in the manifest file, then the address should be resolved without any problems.
http://developer.android.com/reference/java/net/InetAddress.html
In Android 4.0 (Ice Cream Sandwich) and earlier, DNS caching was performed both by
InetAddress and by the C library, which meant that DNS TTLs could not be honored
correctly. In later releases, caching is done solely by the C library and DNS TTLs
are honored.
So, if the address you ask is not older than the lifetime, the cache will respond. If it is not in the cache or expired, the OS will try to find it by going to the DNS server. An exception is thrown only if the Internet connection is not made, or when there is no DNS response, and not when the cache request fails.
However, if you are writing your application for old androids, this problem may still bother you.
There are ways to handle this:
Android: DNS cleanup
source share