title: HttpsURLConnectionImpl.getInputStream() error on Android platform
body: <p>Here's my task.
  Given a pair of latitude and longitude, I want to get a JSON from Google Places API. Following function, reverseGeoCoding, returns the String JSON.</p>
  
  <pre><code>public String reverseGeoCoding(String lat, String lng) {
      latitude = lat;
      longitude = lng;
      String json = new String();
      String url = new String();
  
      URL googleAPI;
      try {
          url = URL + "location=" + latitude + "," + longitude + "&amp;" + "radius=" + radius + "&amp;" + "language=" + language + "&amp;" + "sensor=false" + "&amp;" + "key=" + APIKey;
  
          googleAPI = new URL(url);
          Log.d("TEST", googleAPI.toString());
          URLConnection gc = (URLConnection) googleAPI.openConnection();
          Log.d("TEST", gc.toString());
  
          InputStream is = gc.getInputStream();
          Log.d("TEST", "InputStream created");
          BufferedReader in = new BufferedReader(new InputStreamReader(is));
          Log.d("TEST", "reader created");
          String inputLine;
          while ((inputLine = in.readLine()) != null) {
              json = json + inputLine + "\n";
              Log.d("TEST", inputLine);
          }
  
          in.close();
  
      } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
      return json;
  }
  </code></pre>
  
  <p>However, getInputStream() does not work. I have checked the url request on web browser, and it worked properly (returing a JSON document).</p>
  
  <p>Error messages are below. (Why the lines 17 and 18 produce the errors)</p>
  
  <pre><code>1. 12-11 00:46:02.862: W/System.err(12953): android.os.NetworkOnMainThreadException
  2. 12-11 00:46:02.872: W/System.err(12953):     at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1084)
  3. 12-11 00:46:02.872: W/System.err(12953):     at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
  4. 12-11 00:46:02.872: W/System.err(12953):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
  5. 12-11 00:46:02.872: W/System.err(12953):     at java.net.InetAddress.getAllByName(InetAddress.java:220)
  6. 12-11 00:46:02.872: W/System.err(12953):     at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:71)
  7. 12-11 00:46:02.872: W/System.err(12953):     at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:50)
  8. 12-11 00:46:02.882: W/System.err(12953):     at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
  9. 12-11 00:46:02.882: W/System.err(12953):     at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
  10. 12-11 00:46:02.882: W/System.err(12953):    at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
  11. 12-11 00:46:02.882: W/System.err(12953):    at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
  12. 12-11 00:46:02.882: W/System.err(12953):    at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:460)
  13. 12-11 00:46:02.882: W/System.err(12953):    at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:432)
  14. 12-11 00:46:02.882: W/System.err(12953):    at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
  15. 12-11 00:46:02.882: W/System.err(12953):    at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
  16. 12-11 00:46:02.882: W/System.err(12953):    at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273)
  17. 12-11 00:46:02.882: W/System.err(12953):    at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168)
  18. 12-11 00:46:02.894: W/System.err(12953):    at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:270)
  19. 12-11 00:46:02.894: W/System.err(12953):    at locationpredict.POIList.reverseGeoCoding(POIList.java:55)
  20. 12-11 00:46:02.894: W/System.err(12953):    at locationpredict.TestMain$1.onClick(TestMain.java:62)
  </code></pre>