0

我是 android 开发和 eclipse Juno 版本的新手。我一直在尝试 xml 解析。在调试执行行以检索 xml 时,最终出现以下错误。

// defaultHttpClient
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
//Below Line Shows the Source not found error.
HttpResponse httpResponse = httpClient.execute(httpPost);

错误:

Class File Editor
Source not found
The source attachment does not contain the source for the file DefaultRequestDirector.class.

You can change the source attachment by clicking Change Attached source below:

Change Attached Source...

The source attachment does not contain the source for the file DefaultRequestDirector.class.

但我可以在 Android 4.1==>org.apache.http.impl.client 包中看到 DefaultRequestDirector.class。尝试使用 Cmd+Shift+O 组合键,还尝试了 eclipse 中的“清洁”选项,但最终遇到了同样的问题。

我错过了什么吗?

4

1 回答 1

0

试试下面的代码......看看它是否有帮助:

HttpClient httpclient = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(httpclient.getParams(), 10000);
HttpPost httppost = new HttpPost(url);
HttpResponse response = httpclient.execute(httppost);
于 2012-09-24T06:10:11.603 回答