我正在尝试请求 HTTP,但它在我身上快死了
HttpResponse httpResponse = httpClient.execute(httpGet);
下面是我的代码...
public JSONObject getJSONFromUrl(String url) {
// HTTP Request
try {
// defaultHttpClient
System.out.println("CRAZY1");
HttpClient httpClient = new DefaultHttpClient();
System.out.println("CRAZY2");
HttpGet httpGet = new HttpGet(url);
System.out.println("CRAZY3");
System.out.println("CRAZY4");
HttpResponse httpResponse = httpClient.execute(httpGet);
System.out.println("CRAZY5");
HttpEntity httpEntity = httpResponse.getEntity();
System.out.println("CRAZY6");
is = httpEntity.getContent();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
它告诉我线程正在以未捕获的异常退出。我确实在清单中启用了权限。可能是什么问题呢?