1

在支持linkedin社交网络后,我正在开发的一个应用程序导致了许多崩溃,唯一写的是“androidApplicationContext不能为空!” .

我搜索了互联网,只找到了下一个链接作为线索:

Aug 28 17:15:23 <S3nsat10n> has anyone run across a stacktrace like this? http://pastebin.com/QeV9D8XH
Aug 28 17:15:33 <S3nsat10n> has to do with a null app context inside the apache httpclient
Aug 28 17:15:38 <Hodapp> wongk: yeah, I'm just really confused about why it's doing this...
Aug 28 17:15:47 <S3nsat10n> highly modified httpclient it would seem, judging my the naf.gba package stuff
Aug 28 17:15:51 <S3nsat10n> Seems to be happening only on Samsung Galaxy S devices, but I don't know if that's always the case.
Aug 28 17:16:48 <wongk> S3nsat10n: never see that
Aug 28 17:16:50 <wongk> seen
Aug 28 17:17:17 <S3nsat10n> yeah :/
Aug 28 17:17:22 <S3nsat10n> neither has most of the internet...
Aug 28 17:17:23 <S3nsat10n> heh

有没有其他人得到这个奇怪和超级罕见的错误?

如果是这样,您是如何解决的?

4

1 回答 1

1

两种解决方案:

  • 使用HttpURLConnection而不是HttpClient
  • 尽快在应用程序的主线程中创建一个HttpClient实例,例如在其onCreate方法中。

更多细节在这里

于 2013-08-02T08:21:27.567 回答