title: Host name may not be null in HttpResponse execute for android
body: <p>I get the error "Target host must not be null, or set in parameters". </p>
  
  <ul>
  <li><strong>I DO</strong> have Internet permission in my manifest file</li>
  <li><strong>I have put 'http://' before my Url</strong></li>
  <li><strong>I DO</strong> encode the URL</li>
  </ul>
  
  <p>This  is my code:</p>
  
  <pre><code>   String url = "http://maps.google.com/maps/api/directions/json?origin=1600 Pennsylvania Avenue NW, Washington, DC 20500&amp;destination=1029 Vermont Ave NW, Washington, DC 20005&amp;sensor=false";
     HttpClient httpclient = new DefaultHttpClient();
     String goodURL = convertURL(url);//change weird characters for %etc
     HttpPost httppost = new HttpPost(goodURL);
     HttpResponse response = httpclient.execute(httppost);
  </code></pre>
  
  <p>In 5th line (last line above), my program throws an exception. here is the exact error:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Host name may not be null
  </code></pre>
  
  <p><strong>I Do encode my string in method convertURL...</strong></p>
  
  <p>goodURL= <code>http://maps.google.com/maps/api/directions/json?origin=3%20Cedar%20Ave%2c%20Highland%20Park%2c%20NJ%2008904&amp;destination=604%20Bartholomew%20Road%2c%20Piscataway%2c%20New%20Jersey%2008854&amp;sensor=false</code></p>
  
  <p>Any suggestions?
  Thanks!</p>