我正在尝试使用 HTTP GET 请求编写一个基本应用程序。 Eclipse 验证了我的代码,但是当我在 Android 控制台中使用 IOException
时,我收到了这条奇怪的消息:
trouble writing output: null
[2009-07-29 17:22:49 - myapp] Conversion to Dalvik format failed with error 2
而且我的应用程序没有加载到模拟器中。这是我的代码:
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;
谁知道问题出在哪里?
最佳答案
这时不时地弹出,但还没有找到 dx 中的错误。你有 -XX:+AggressiveOpts JVM 选项吗?查看最新报告:
http://code.google.com/p/android/issues/detail?id=5817
这是与这个 stackoverflow 页面相对应的错误(我关闭了该页面,因为作者从未提供我们重现该问题所需的信息):
关于java - Android 和 IOException - 奇怪的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1200688/