得到“androidApplicationContext必须不为空!”崩溃报告服务崩溃

时间:2013-07-17 14:58:09

标签: android crash-reports illegalargumentexception applicationcontext

在支持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

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

如果是这样,你是如何解决它的?

1 个答案:

答案 0 :(得分:1)

两种解决方案:

  • 使用 HttpURLConnection 代替 HttpClient
  • 尽快在应用程序的主线程中创建 HttpClient 的实例,例如在 onCreate 方法中。

更多详情here