Note that there are some explanatory texts on larger screens.

plurals
  1. POhow do i figure out how to debug this? HttpResponse
    text
    copied!<p>I'm trying to make a json object from the result of the googleplaces api. But one line of code is causing me alot of problems. My question is how the heck do i find what the issue is. I can't seem to catch the right exception (im a noob at debugging though). The url that i am passing in has the value: <a href="https://maps.googleapis.com/maps/api/place/search/json?location=34.7,-86.5&amp;radius=16000&amp;types=food&amp;name=mcdonalds&amp;sensor=true&amp;key=(myApiCodeWhichImNOTPostingHere" rel="nofollow">https://maps.googleapis.com/maps/api/place/search/json?location=34.7,-86.5&amp;radius=16000&amp;types=food&amp;name=mcdonalds&amp;sensor=true&amp;key=(myApiCodeWhichImNOTPostingHere</a>)</p> <p>^i do have the correct apicode and the link works ourside of android.</p> <p>here is the method in question (highlighted is the line that is causing problems).</p> <pre><code> public static JSONObject getTheJSON(String url){ JSONObject json=null; try{ DefaultHttpClient myHttpClient = new DefaultHttpClient(); HttpPost myHttpPost = new HttpPost(url); //this line below is giving me problems (jumps streight to the catch Exception) HttpResponse response = myHttpClient.execute(myHttpPost); //this line above is giving me problems(jumps streight to the catch Exception) String data = EntityUtils.toString(response.getEntity()); json= new JSONObject(data); //parse the JSONObject } catch (UnsupportedEncodingException e){e.printStackTrace();} catch (ClientProtocolException e){e.printStackTrace();} catch (IOException e){e.printStackTrace();} catch (JSONException e) {e.printStackTrace();} catch (NullPointerException e){ Log.e("My APP", "exception: " + e.getMessage());} /* jumps to line below (skips the other catch exceptions) the log reads "null" since i use the "getMessage()" so thats not useful*/ catch (Exception e ) { Log.e("My APP", "exception: " + e.getMessage());} return json; // returning the JSON object } </code></pre> <p>(Edit): Here is the logcat. i think im getting a connection to factory client error </p> <pre><code>10-16 21:11:30.105: E/My APP(980): exception 10-16 21:11:30.345: E/MapActivity(980): Couldn't get connection factory client </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload