Android 应用程序在构造 Gson 对象时崩溃...无法查看异常详细信息

发布于 2024-11-08 14:08:26 字数 251 浏览 0 评论 0原文

我正在开发一个小应用程序并从服务器检索数据。在调试模式下,我可以看到格式正确的 JSON 字符串被接收并存储在我的 var 中。 在我尝试实例化 Gson 对象之后(使用 Gson gson = new Gson(); 就在这一行死掉了) 它就死了......我似乎无法在 log cat 中获得任何输出,所以我看不到抛出的异常。我刚刚从 Windows 迁移到 Ubuntu(64 位),所以很可能我在设置中遗漏了一些东西,但其他一切都工作正常,我发现很难追踪它发生的原因......

I'm working on a little app and retrieving data from a server. In debug mode I can see the properly formatted JSON string is received and stored in my var.
Right after I try instantiating a Gson object ( using Gson gson = new Gson(); it dies on this line)
and it just dies... I can't seem to get any output in log cat so I can't see the exception being thrown. I've just migrated from windows to Ubuntu (64 bit) so it's quite possible I'm missing something in my set up but everything else works fine and I'm finding it hard to trace why it happens...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝海 2024-11-15 14:08:26

如果强制关闭,堆栈跟踪应该 100% 显示在 logcat 中。
否则,这是一个简单的对象构造,因此可以检查库的构建路径。也尝试清理项目,但你的代码应该可以工作......

if there is a force close the stacktrace should 100% show up in logcat.
otherwise this is a simple object construction so maybe check the buildpath for the libraries. also try cleaning the project but your code should be working...

日久见人心 2024-11-15 14:08:26

好吧,事实证明这与 eclipse 和 mylyn 的一个已知问题有关。
将 mylyn.jar 文件移出 eclipse 的插件文件夹似乎可以解决该问题。

(Gson 对象正在构建良好,我现在正在使用它...当我尝试从数组列表中删除项目时,异常是不支持的异常...奇怪,因为这是在构造 gson 对象之前的几个阶段完成的

)不完全是同一个问题(因为 logcat 中有输出......只是不会显示与错误/异常相关的任何内容,并且处于详细模式和其他模式)。

更多信息:
http://groups.google.com/group/android-developers/browse_thread/thread/c64de09595795538/8e577a1e52b26c73?lnk=gst&q=eclipse+19%25#8e577a1e52b26c73

为什么 logcat 在我的 Android 中不显示任何内容?

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

非常奇怪的错误,将 mylyn 罐子放回文件夹中,一切正常。因此,过程如下:

打开 path/to/eclipse/plugin/

剪切所有 *mylyn.jar 文件,

将它们粘贴到 eclipse 目录之外的临时文件夹中。

启动/重新启动 eclipse 并测试 log cat 是否正常工作

一切顺利吗?某些功能(例如代码完成)现在可能无法工作...将 mylyn.jar 文件移回插件文件夹(我不确定当您将它们移回时 Eclipse 是否打开是否重要,但它是当我这样做时正在运行。)

重新启动 Eclipse,你应该可以开始了......

Okay, turns out this is related to a known issue with eclipse and mylyn.
Moving the mylyn.jar files out of eclipse's plugin folder seems to solve the issue.

(Gson object is being constructed fine and I'm making use of it now...exception was unsupportedexception when i was trying to remove items from an arraylist...odd because this is done several stages before constructing the gson object)

Although this was not entirely the same issue (because there was output in logcat...just wouldn't show anything related to errors/exceptions, and that's in verbose mode and others).

More info:
http://groups.google.com/group/android-developers/browse_thread/thread/c64de09595795538/8e577a1e52b26c73?lnk=gst&q=eclipse+19%25#8e577a1e52b26c73

Why doesn't logcat show anything in my Android?

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

Very weird bug, putting the mylyn jars back in the folder and everything works. So the process then:

Open path/to/eclipse/plugin/

cut all *mylyn.jar files

paste them into a temporary folder outside of the eclipse directory.

start/restart eclipse and test that log cat works

All is well? Some feature such as code completion probably isn't working now... Move the mylyn.jar files back to the plugin folder (I'm not sure if it matters whether eclipse is opened or not when you move them back in but it was running when i did it.)

restart eclipse and you should be good to go...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文