這裏是我的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