Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8677177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:23:19+00:00 2026-06-12T20:23:19+00:00

From old posts such as Android java.net.UnknownHostException: Host is unresolved (strategy question) , it

  • 0

From old posts such as Android java.net.UnknownHostException: Host is unresolved (strategy question), it suggested to use the following code:

  try {
      InetAddress i = InetAddress.getByName(URLName);
    } catch (UnknownHostException e1) {
      e1.printStackTrace();
    }

So does it mean when a DNS entry is not being cached in the device, e.g. after bootup, it will return java.net.UnknownHostException: Host for the 1st time, even for a valid DNS?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:23:20+00:00Added an answer on June 12, 2026 at 8:23 pm

    It depends on the version of android.

    Provided you have an Internet connection and that your application declares that it needs Internet access in the manifest file, then the address should resolve 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 are asking for is not older than the time to live, the cache will answer. If it is not in the cache or has expired then the OS will try to find it by going to a DNS server. The exception is thrown only when your Internet connection is not up, or when there is no DNS response, not when the cache request fails.

    That said, if you are writing your application for older androids, then this problem may pester you still.

    There are ways to deal with it:
    Android: Flush DNS

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi im strugeling with SQLite in android. Im trying to delete old posts from
We are done migrating a website from old CMS to SDL Tridion. We have
I'm migrating a Delphi project from old Delphi 2.0 IDE to the new RAD
From my old Access days, there was a First() function that allowed you to
I am upgrading from the old SecureWebPages that automates the switching between Http and
I get output files from very old Fortran programs, which look like: 0.81667E+00 -0.12650E+01
I moved a VS Solution file from an old PC to a new PC.
I have copied a project from my old XP machine to my new Win7
How to get a new sequence from an old sequence, the elements of the
I'm trying to migrate my application from the old App Engine db to ndb.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.