Java 通过ACRA报告我自己的异常

Java 通过ACRA报告我自己的异常,java,android,acra,Java,Android,Acra,假设我有这样的东西: int zero = 1; if (zero!=0) { // have ACRA handle this as an error with stack trace and show the value // of zero, but silently, without the app crashing or bothering the user } 我怎么能这样做?我需要它,因为我已经用尽了大多数适当的崩溃,但我的应用程序仍然存在不会导致崩溃的错误,并且

假设我有这样的东西:

int zero = 1;
if (zero!=0) {
    // have ACRA handle this as an error with stack trace and show the value
    // of zero, but silently, without the app crashing or bothering the user
}
我怎么能这样做?我需要它,因为我已经用尽了大多数适当的崩溃,但我的应用程序仍然存在不会导致崩溃的错误,并且最好对这些错误使用相同的错误报告系统


我知道如何将应用程序的Logcat输出作为错误报告的一部分发送,但这似乎太多了,我只需要几个值,可能是一个字符串。

如中所述,您可以使用将任何异常状态发送到ACRA,而无需通知用户。如果没有“真实”异常作为参数传入,则可以创建自己的(
newruntimeexception(“zero!=0”)
)或传入
null
以使用默认的
新异常(“开发人员请求的报告”)

是的,太好了!因此,我只需使用
ACRA.getErrorReporter().handleSilentException(新的RuntimeException(“任意我想要的”)
,它不会使应用程序崩溃?是的,它只会向ACRA发送报告,而不会崩溃或通知用户。