Problem description
Native crash refers to a case where a process exits because a Linux error signal is generated from a C or C++ error. You can use the logcat of the system to analyze crash logs.
Solution
A process exits when a C or C++ error occurs and the system generates a Linux error signal. We recommend that you use the ndk-stack tool for analysis and troubleshooting.
In Android development, crash logs can be caught at the Java layer, but crash logs at the native layer cannot be directly obtained. The logcat of the system can be used to analyze crash logs. We recommend that you use the NDK tool ndk-stack for analysis and troubleshooting.
Download the latest version of NDK. The ndk-stack tool is in the NDK home directory.
Find the test that has a native crash in the Mobile Testing module and download the log entries.
Find the CPU information
ro.product.cpu.abibased on the failed model. For example, the CPU type of Samsung N7100 is armeabi-v7a.The CPU type of all simulators in the Mobile Testing module is x86_64.Run the following command in the ndk-stack tool to locate the error:
$NDK/ndk-stack -sym $PROJECT_PATH/obj/local/$cpu.abi -dump $LOGCAT_PATHThe following command is used in this example:
ndk-stack -sym ./workspace2/testNdkStack/obj/local/armeabi-v7a/ -dump ./logcat.log > result.logBy analyzing the result log, you can check the code file and locate the specific row in which the crash appears.