/xCrash

πŸ”₯πŸ”₯ A crash reporting library for Android APP. Support catching native crash and Java exception.

Primary LanguageCOtherNOASSERTION

xCrash

xCrash is a crash reporting library for Android APP. It supports 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.

intro

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

README δΈ­ζ–‡η‰ˆ

Features

  • Support Android 4.0 - 10 (API level 14 - 29).
  • 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.

Overview Maps

Architecture

catching native crash

Catching Native Crash

catching native crash

Usage

1. Add dependency.

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

2. Specify one or more ABI(s) you need.

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

3. Initialize xCrash.

Java

public class MyCustomApplication extends Application {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        
        xcrash.XCrash.init(this);
    }
}

Kotlin

class MyCustomApplication : Application() {

    override fun attachBaseContext(base: Context) {
        super.attachBaseContext(base)

        xcrash.XCrash.init(this)
    }
}

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

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

Build

If you want to build xCrash from source code. Follow this guide:

1. Download Android NDK r16b, set PATH environment.

2. Build and copy the native libraries.

cd ./src/native/
./build.sh
./install.sh

3. Build AAR library.

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

Support

  1. Check the xcrash-sample.
  2. Communicate on GitHub issues.
  3. Email: caikelun@gmail.com
  4. WeChat: alan_choi
  5. QQ group: 603635869. QR code:

qq group

Contributing

See xCrash Contributing Guide.

License

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

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