xCrash provides the Android app with the ability to capture java crash, native crash and ANR. No root permission or any system permissions are required.
xCrash can generate a tombstone file (similar format as Android system's tombstone file) in the directory you specified when the app process crashes or ANRs.
xCrash has been used in many Android apps (including iQIYI video) on different platforms (mobile, tablet, TV) ofiQIYIfor many years.
- Support Android 4.1 - 11 (API level 16 - 30).
- Support armeabi-v7a, arm64-v8a, x86 and x86_64.
- Capturing java crash, native crash and ANR.
- Dumping detailed statistics about process, threads, memory, FD and network.
- Setting which thread's info should be dumped via regular expressions.
- Do not require root permission or any system permissions.
- java crash
- native crash (armeabi-v7a)
- native crash (arm64-v8a)
- native crash (x86)
- native crash (x86_64)
- ANR (armeabi-v7a)
- ANR (arm64-v8a)
- ANR (x86)
- ANR (x86_64)
dependencies{
implementation'com.iqiyi.xcrash:xcrash-android-lib:3.0.0'
}
android{
defaultConfig {
ndk {
abiFilters'armeabi-v7a','arm64-v8a','x86','x86_64'
}
}
}
Java
publicclassMyCustomApplicationextendsApplication{
@Override
protectedvoidattachBaseContext(Contextbase) {
super.attachBaseContext(base);
xcrash.XCrash.init(this);
}
}
Kotlin
classMyCustomApplication:Application() {
overridefunattachBaseContext(base:Context) {
super.attachBaseContext(base)
xcrash.XCrash.init(this)
}
}
Tombstone files will be written toContext#getFilesDir() + "/tombstones"
directory by default. (usually in:/data/data/PACKAGE_NAME/files/tombstones
)
There is a more practical and complex sample app in thexcrash_samplefolder.
If you want to build xCrash from source code. Follow this guide:
./gradlew:xcrash_lib:build
xCrash is MIT licensed, as found in theLICENSEfile.
xCrash documentation is Creative Commons licensed, as found in theLICENSE-docsfile.