I am trying to write a basic application with an HTTP GET request. Eclipse confirmed my code, but when I use IOExceptionthe Android console, I get this strange message:
problem write output: null
[2009-07-29 17:22:49 - myapp] Conversion to Dalvik format failed with error 2
And my application does not load into the emulator. This is my code:
HttpHost target = new HttpHost("google.com", 80);
HttpGet get = new HttpGet("/");
String result = null;
HttpEntity entity = null;
HttpClient client = new DefaultHttpClient();
try {
HttpResponse response=client.execute(target, get);
entity = response.getEntity();
result = EntityUtils.toString(entity);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (entity!=null){}
try {
entity.consumeContent();
} catch (IOException e) {}
}
return result;
Does anyone know what the problem is?
source
share