Android应用程序不会崩溃,但不会对未捕获的异常做出响应

hun*_*dym 10 java android google-analytics uncaughtexceptionhandler

我最近注意到,当未捕获的异常发生时,我的应用程序不会崩溃,但它没有响应.我使用谷歌分析来获得崩溃的洞察力,我怀疑这可能是问题的原因.

当我扔进NullPointerExceptiononCreate()(紧接着)后super.onCreate(),该应用程序显示一个白色的屏幕,但它不会崩溃.

Logcat说:

06-30 14:00:59.386  26259-26259/? I/GAv4? Google Analytics 7.5.71 is starting up. To enable debug logging on a device run:
    adb shell setprop log.tag.GAv4 DEBUG
    adb logcat -s GAv4
06-30 14:00:59.398  26259-26259/? W/GAv4? AnalyticsReceiver is not registered or is disabled. Register the receiver for reliable dispatching on non-Google Play devices. See http://goo.gl/8Rd3yj for instructions.
06-30 14:00:59.409  26259-26259/? W/GAv4? CampaignTrackingReceiver is not registered, not exported or is disabled. Installation campaign tracking is not possible. See http://goo.gl/8Rd3yj for instructions.
06-30 14:00:59.414  26259-26295/? W/GAv4? AnalyticsService not registered in the app manifest. Hits might not be delivered reliably. See http://goo.gl/8Rd3yj for instructions.
06-30 14:00:59.467  26259-26259/? D/AndroidRuntime? Shutting down VM
Run Code Online (Sandbox Code Playgroud)

我希望看到未被捕获的异常,因为如果我没有看到堆栈跟踪和问题的原因,那么很难修复它们.

我该怎么做才能恢复以前的行为?

编辑:删除分析错误报告(而不是调用tracker.enableExceptionReporting(true);)后,我再次崩溃.我使用Play Services 7.5.0中的Analytics.

Jor*_*lla -1

默认情况下,它们Exceptions显示在控制台中。

如果您不想检查控制台(我认为为此目的更方便,因为Logcat有时会很混乱),那么只需ExceptionLog捕获时显示 s 即可。

try {

} catch (Exception e) {
    Log.e("YOUR_APP_TAG", "Exception occured: ", e);
}
Run Code Online (Sandbox Code Playgroud)