xCrash provides the Android app with the ability to capture java crashes, native crashes 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 ANR.
xCrash is used in a variety of Android apps (including iQIYI Video) from iQIYI for many years.
- Support Android 4.0 - 10 (API level 14 - 29).
- Support armeabi, armeabi-v7a, arm64-v8a, x86 and x86_64.
- Capturing java crashes, native crashes and ANR.
- Dumping detailed memory usage statistics.
- Setting which thread's info should be dumped via regular expressions.
- Do not require root permission or any system permissions.
dependencies {
implementation 'com.iqiyi.xcrash:xcrash-android-lib:2.4.3'
}
android {
defaultConfig {
ndk {
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
}
}
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.
If you want to build xCrash from source code. Follow this guide:
1. Download Android NDK r16b, set PATH environment.
cd ./src/native/
./build.sh
./install.sh
cd ./src/java/xcrash/
./gradlew :xcrash_lib:build
- Check the xcrash-sample.
- Communicate on GitHub issues.
- Email: caikelun@gmail.com
- QQ group: 603635869. QR code:
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.