xCrash
xCrash copied to clipboard
子线程连续2次 native 崩溃,无法捕获异常信息
- 打开 Demo工程:xcrash_sample
- 修改
MainActivity
中的testNativeCrashInAnotherNativeThread_onClick
方法如下:
public void testNativeCrashInAnotherNativeThread_onClick(View view) {
XCrash.testNativeCrash(true);
XCrash.testNativeCrash(true);
}
-
移除布局文件
activity_main.xml
中的 WebView (这一步骤非常重要)
<!-- <WebView-->
<!-- android:id="@+id/webview"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:padding="20dp" />-->
- 运行之,点击【native crash (in another native thread)】按钮,应用崩溃,但是无法获取到堆栈
2022-11-27 09:44:49.497 25789-25925 xcrash xcrash.sample D crashed APP's thread is running ...... 1
2022-11-27 09:44:49.510 25789-25928 xcrash xcrash.sample D crashed APP's thread is running ...... 1
2022-11-27 09:44:49.521 25789-25929 libc xcrash.sample A Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7a4735b6c0 in tid 25929 (xcrash_test_cal), pid 25789 (xcrash.sample)
2022-11-27 09:44:50.052 25789-25925 xcrash xcrash.sample D crashed APP's thread is running ...... 2
2022-11-27 09:44:50.052 25789-25928 xcrash xcrash.sample D crashed APP's thread is running ...... 2
2022-11-27 09:44:50.053 25789-25929 libc xcrash.sample A crash_dump helper failed to exec
2022-11-27 09:44:50.137 1429-1652 InputDispatcher pid-1429 E channel '7c7d499 xcrash.sample/xcrash.sample.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
---------------------------- PROCESS ENDED (2578
使用华为mate 30是可以的。你再试试其他手机。
我这边没有华为 mate 30, 用的是荣耀10以及OPPO reno都可以复现,上面也贴了log信息,确实是没有捕获到堆栈的