我正在尝试从以下代码访问我的 uri
AsyncTask asyncTask = new AsyncTask() {
@Override
protected Object doInBackground(Object... params) {
AndroidHttpClient httpClient = AndroidHttpClient.newInstance("");
HttpUriRequest uriGetRequest = new HttpGet("http://localhost:8080/restsql-0.8.6/res/");
HttpResponse httpResponse = null;
try {
httpResponse = httpClient.execute(uriGetRequest);
;
} catch (Exception e) {
// TODO Auto-generated catch block
if(e!=null){
Log.e("ModelLoader", e.getMessage(), e);
}
Log.e("Model Loader", "Error while calling execute");
}
return httpResponse;
}
};
asyncTask.execute(new Object());
但总是 httpresponse 为空。甚至没有抛出异常。我已经检查了像https://google.co.in/这样的有效 uri并且它工作正常。我的浏览器 URI 也工作正常。由于没有抛出异常,我无法继续进行。