Android and IOException - weird bug

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?

+1
source share
3 answers

it appears again and again, but an error in dx has not yet been detected. do you have the -XX: + AggressiveOpts JVM option? see the latest report:

http://code.google.com/p/android/issues/detail?id=5817

, stackoverflow ( , , ):

http://code.google.com/p/android/issues/detail?id=3480

+9

, , Eclipse Android SDK Windows 7. , Eclipse .

0

, , , , , . IOException, , , , , , .. . . , - , .

0

Source: https://habr.com/ru/post/1712820/


All Articles