本文介绍了在Galaxy Nexus的怪异EOFException类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Andr​​oid应用程序使用的URLConnection 来连接到一个Web服务。这是在市场结束了一年工作的很好。然而,随着Galaxy Nexus的用户的问题最近想出了:

My Android application uses URLConnection to connect to a webservice. It's in the market over a year now and works quite well. However, problems with Galaxy Nexus users came up recently:

在获得从输入流(甚至不读书呢!)在的URLConnection 这样的:

When getting the input stream (not even reading yet!) from the URLConnection like:

final BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()), 8192);

A EOFException类的getInputStream被抛出()

首先我认为这可能是一个ICS的问题,所以我安装我的Nexus S的一个早期版本,但我无法重现该问题。然后,我获得了Galaxy Nexus的,它以同样的方式作为崩溃我收到的bug报告,这使我相信,它可能不是一个单一的电话的情况怪怪的。

First I thought this may be an ICS problem, so I installed an early build on my Nexus S, but there I couldn't reproduce the problem. Then I got access to a Galaxy Nexus, which crashes in the same way as the bug reports I've received, which makes me believe that it's probably not a case of a single phone acting weird.

崩溃的堆栈跟踪可以看出和整个code。关于 GitHub上。这很古怪,应用程序对Android Market的10万某些+安装,问题似乎只是在Galaxy Nexus的发生。

The stack trace of the crash can be seen here and the whole code on GitHub. It's really weird, the app has some 100k+ installations on Android Market and the problem only seem to occur on the Galaxy Nexus.

任何提示或建议将不胜AP preciated!

Any hints or suggestions would be greatly appreciated!

推荐答案

我(注意!非ICS)我的应用程序的开发过程中看到我的Xperia弧S上的同样的问题。我几乎可以肯定,我们看到了两个不同的问题,同样的症状,虽然

I've seen the same issue on my Xperia Arc S (Note! Non-ICS) during development of my app. I'm almost certain that we see the same symptom of two different problems, though.

在我来说,我在读了整个流作为UTF8 字符串但服务器端实现期待我读的第一个字节的数字字节键,它的其余部分为UTF8 字符串

In my case I was reading the entire stream as a UTF8 String but the server side implementation was expecting me to read the first byte as a numeric byte and the rest of it as UTF8 String.

我不知道对我为什么的细节真的的有一个 EOFException类,但读数据流,在关注类型在它的自定义协议,解决了我的问题。

I'm not sure on the details for why I really got an EOFException, but reading the stream, paying attention to the types in the custom protocol in it, solved my problem.

这篇关于在Galaxy Nexus的怪异EOFException类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 08:29