2015-07-21 71 views
7

我在我的项目中创建了一个http请求。我坐在它,但没有奏效 这样简化的部分来测试它:这是它:执行httpclient时出现奇怪的错误

HttpClient cl = new DefaultHttpClient(); 
    try { 
     HttpResponse httpResponse = cl.execute(new HttpGet("http://www.google.com")); 
     System.out.println(httpResponse.getEntity().getContentLength()); 
    } 
    catch (Exception e) 
    { 
     System.out.println("didn't work!"); 
     System.out.println(e.getMessage()); 
    } 

但是当我运行它,我得到这些:

07-21 15:57:36.203 26851-26851/com.akgradev.upbman W/﹕ Unable to open '/system/framework/qcom.fmradio.jar': No such file or directory 
07-21 15:57:36.203 26851-26851/com.akgradev.upbman W/art﹕ Failed to open zip archive '/system/framework/qcom.fmradio.jar': I/O Error 

和当然是“没有工作!”和一个“null”的打印!我赞赏 您的提示Tnx

+1

这个例外很奇怪。你能否粘贴你的完整代码。这可能有助于获得洞察力。谢谢。 –

+0

您能否提供完整的异常堆栈跟踪? – hagrawal

+0

我不明白!用一个按钮(!)制作一个新项目,以获得google.com的内容长度,并仍然存在相同的问题!代码正是这个(上图)。给它一个按钮的onClickListener –

回答