title: Value <html> of type java.lang.String cannot be converted to JSONObject
body: <p>I make "GET" request in order to get a JSON object. When i try to read the response, an error is thrown. The error is descriped in the header. 
  It's a really miracle for me, because when i run the app on the emulator or in the browser, i get JSON response, everything is ok. But when i run it on real phone, i see this error....
  Will be grateful for any answer. Here is my code.</p>
  
  <pre><code>class Task extends AsyncTask&lt;String, Void, String&gt; {
  StringBuilder builder;
  
  @Override
  protected String doInBackground(String... params) {
      HttpURLConnection connection;
      try {
          URL url = new URL(params[0]);
          connection = (HttpURLConnection) url.openConnection();
          connection.setRequestMethod("GET");
          connection.connect();
  
          BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
          builder = new StringBuilder();
          String line;
          while ((line = reader.readLine()) != null) {
              builder.append(line);
          }
      } catch (IOException e) {
          e.printStackTrace();
          Log.e("log", "background error " + e);
      }
      return builder.toString();
  }
  
  @Override
  protected void onPostExecute(String s) {
  
      Log.e("log", "response " + s);
  
      try {
          JSONObject jsonObject = new JSONObject(s);
          Log.e("log", "JSON = " + jsonObject);
      } catch (JSONException e) {
          e.printStackTrace();
          Log.e("log", "post error " + e);
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This is the String i get in post Execute</p>
  
  <pre><code>&lt;html&gt;                            &lt;body&gt;                                
  &lt;script type='text/javascript' charset='utf-8'&gt;                                    
  window.location.href = '/';                                &lt;/script&gt;                            
  &lt;/body&gt;                        &lt;/html&gt;                        
  </code></pre>
  
  <p>And here is the error i get</p>
  
  <pre><code>05-04 08:56:19.989 2731-2731/? W/System.err: org.json.JSONException: Value 
  &lt;html&gt; of type java.lang.String cannot be converted to JSONObject
  05-04 08:56:19.989 2731-2731/? W/System.err:     at 
  org.json.JSON.typeMismatch(JSON.java:111)
  05-04 08:56:19.989 2731-2731/? W/System.err:     at org.json.JSONObject.
  &lt;init&gt;(JSONObject.java:158)
  05-04 08:56:19.989 2731-2731/? W/System.err:     at org.json.JSONObject.
  &lt;init&gt;(JSONObject.java:171)
  05-04 08:56:19.989 2731-2731/? W/System.err:     at 
  com.example.dshahzadyan.gettest.Task.onPostExecute(MainActivity.java:64)
  05-04 08:56:19.999 2731-2731/? W/System.err:     at 
  com.example.dshahzadyan.gettest.Task.onPostExecute(MainActivity.java:33)
  05-04 08:56:19.999 2731-2731/? W/System.err:     at 
  android.os.AsyncTask.finish(AsyncTask.java:602)
  05-04 08:56:19.999 2731-2731/? W/System.err:     at 
  android.os.AsyncTask.access$600(AsyncTask.java:156)
  05-04 08:56:19.999 2731-2731/? W/System.err:     at 
  android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  05-04 08:56:19.999 2731-2731/? W/System.err:     at 
  android.os.Handler.dispatchMessage(Handler.java:99)
  05-04 08:56:19.999 2731-2731/? W/System.err:     at 
  android.os.Looper.loop(Looper.java:137)
  05-04 08:56:19.999 2731-2731/? W/System.err:     at 
  android.app.ActivityThread.main(ActivityThread.java:4517)
  05-04 08:56:19.999 2731-2731/? W/System.err:     at 
  java.lang.reflect.Method.invokeNative(Native Method)
  05-04 08:56:19.999 2731-2731/? W/System.err:     at 
  java.lang.reflect.Method.invoke(Method.java:511)
  05-04 08:56:19.999 2731-2731/? W/System.err:     at 
  </code></pre>