这里是我的HTTP GET方法连接到的网址:为什么在这种情况下未知的主机?
public void executeHttpGet() throws Exception {
try {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://test.mobibon.com.tw/MovieGoTest/GetMovies.js");
HttpResponse response = client.execute(request);
String retSrc = EntityUtils.toString(response.getEntity());
Log.i("bird",retSrc);
} finally {
}
}
这里就是我把它叫做:
try {
executeHttpGet();
} catch (Exception e) {
Log.i("bird","nothing");
e.printStackTrace();
}
http://test.mobibon.com.tw/MovieGoTest/GetMovies.js < -----这个网址正常工作在我的浏览器
但是异常消息是:UnknownHostException
为什么?
我之前已经添加此权限。 ... 但仍然感谢您的帮助! – bbbbbird1 2012-01-05 08:25:39
在这里,我也可以成功访问url,尝试重新构建并运行,或关闭所有网络适配器并打开。 – idiottiger 2012-01-05 08:34:19