0

显然,使用代码,任何地方都可能发生错误。因此,如果没有到处都有 try/catch 块(据我所知,这是主要开销),我如何允许错误冒泡到应用程序级别,然后在那里处理它们?或者至少,以某种方式记录错误以进行故障排除?我找到了有关名为 ACRA 的产品的信息,但设置说明是针对 Eclipse 项目的。我在 Visual Studio 2010 中使用 Mono for Android。

4

2 回答 2

0

That's a bit of an "It depends" question.

The appropriate handling of an errors is going to depend on what the recovery strategy needs to be, how much information you want the user to see etc.

I wouldn't worry how many Try/Catch blocks you use - just use them wherever you need to handle an error that gets thrown - if they're everywhere, your strategy is probably wrong.

It terms of logging and later interrogation, you can log caught errors using the Android.Util.Log class.

These can be interrogated (provided you're debugging on your own device) using Logcat.

There's some more info on logging and Logcat here.

于 2012-09-13T19:08:31.263 回答
0

找到了这个将崩溃信息写入谷歌文档的项目。 安卓崩溃

于 2012-10-05T20:49:36.523 回答