Watch 14 Star 74 Fork 18

caikelun / xCrashC

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
一个 Android APP 的崩溃捕获库。支持捕获 native 崩溃和 Java 异常。支持 Android 4.0 - 9.0 (API level 14 - 28)。支持 armeabi,armeabi-v7a,arm64-v8a,x86 和 x86_64。 spread retract

  • C 91.6%
  • Java 7.5%
  • C++ 0.6%
  • Makefile 0.2%
  • Shell 0.1%
Clone or download


xCrash is a crash reporting library for Android APPs. It support catching native crash and Java exception.

xCrash can generate a tombstone file (similar format as Android system's tombstone file) in the directory you specified when the APP process crashes. And, no root permission or any system permissions are required.

xCrash is used in a variety of Android APPs (including iQIYI Video) from iQIYI for many years.



  • Support Android 4.0 - 9.0 (API level 14 - 28).
  • Support armeabi, armeabi-v7a, arm64-v8a, x86 and x86_64.
  • Catching native crash and Java exception.
  • Setting which thread's info should be dumped via regular expressions.
  • Dumping detailed memory usage statistics.
  • Do not require root permission or any system permissions.

Catching Native Crash

catching native crash


1. Adding dependency.

dependencies {
    implementation 'com.iqiyi.xcrash:xcrash-android-lib:2.0.10'

2. Specifying ABI(s) you need.

android {
    defaultConfig {
        ndk {
            abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'

3. Adding ProGuard rules.

-keep class xcrash.NativeCrashHandler {
    native <methods>;
    void callback(...);

4. Initialize xCrash in Application#attachBaseContext().

public class MyCustomApplication extends Application {

    protected void attachBaseContext(Context base) {

Tombstone files will be written to Context#getFilesDir() + "/tombstones" directory by default. (usually in: /data/data/<APP_PACKAGE_NAME>/files/tombstones)

There is a more practical and complex sample APP in the src/java/xcrash/xcrash_sample folder.


1. Download Android NDK r16b, set PATH environment.

2. Build and install the native libraries.

cd ./src/native/

3. Build AAR library.

cd ./src/java/xcrash/
./gradlew :xcrash_lib:build


See xCrash Contributing Guide.


xCrash is MIT licensed, as found in the LICENSE file.

xCrash documentation is Creative Commons licensed, as found in the LICENSE-docs file.

Comments ( 1 )

You need to Sign in for post a comment

Help Search