title: Unable to resolve host: URL No address associated with hostname
body: <p>I have an web service call to bring down a JSON object and it only works if I have the IP address and not the host name. I have been fine using IP addresses but now I need to have the host name.</p>
  
  <p>Here is my code</p>
  
  <pre><code>    StringBuilder stringBuilder = new StringBuilder();
      HttpParams httpParams = new BasicHttpParams();
      HttpConnectionParams.setConnectionTimeout(httpParams, 3000);
      HttpConnectionParams.setSoTimeout(httpParams, 7000);
      DefaultHttpClient httpClient = new DefaultHttpClient(httpParams);
      HttpPost httpost = new HttpPost(URL);
      try {
          HashMap&lt;String,String&gt;  params = new HashMap&lt;String,String&gt;();
          // Login info
          params.put("username", edtUserName.getText().toString()); 
          params.put("password", edtPass.getText().toString());
          params.put("deviceOS", "Android");
          params.put("deviceOSVersion", android.os.Build.VERSION.RELEASE);
          params.put("language", "0");
          //JSON object holding the login info
          JSONObject holder = new JSONObject(params);
  
          StringEntity se = new StringEntity(holder.toString());
  
          httpost.setEntity(se);
  
          httpost.setHeader("Content-Type", "application/json");
          //Executing the call
          HttpResponse response = httpClient.execute(httpost);
          StatusLine statusLine = response.getStatusLine();
          int statusCode = statusLine.getStatusCode();
          if (statusCode == 200) {
              HttpEntity entity = response.getEntity();
              InputStream inputStream = entity.getContent();
              BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
              String line;
              while ((line = reader.readLine()) != null) {
                  stringBuilder.append(line);
              }
              inputStream.close();
          } else {
              returnCode = -1;
              Log.d("JSON", "Failed to download file");
          }
      } catch (Exception e) {
          returnCode = -1;
          Log.d("readJSONFeed", e.getLocalizedMessage());
      }
  
      return stringBuilder.toString();
  </code></pre>
  
  <p>I dont know why that doesn't work. I am testing on a phone with Wifi connection, My manifest has the <code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;</code> and <code>&lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;</code></p>
  
  <p>This web service does work. Just not on Android</p>
  
  <p>If anyone has an idea that would be great, Thanks.</p>