Skip to content
/ xCrash Public
forked from iqiyi/xCrash

🔥 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.

License

Unknown, CC-BY-4.0 licenses found

Licenses found

Unknown
LICENSE
CC-BY-4.0
LICENSE-docs
Notifications You must be signed in to change notification settings

ntbps/xCrash

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xCrash

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.

intro

xCrash has been used in many Android apps (including iQIYI video) on different platforms (mobile, tablet, TV) of 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.
  • 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.

Tombstone File Previews

Overview Maps

Architecture

architecture

Capture Native Crash

capture native crash

Capture ANR

capture anr

Usage

1. Add dependency.

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

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.

src/java/xcrash/local.properties

sdk.dir=your/path/to/sdk
ndk.dir=your/path/to/ndk

2. Build AAR library.

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

If you need libxcrash.so & libxcrash_dumper.so to build your own executable binary file, please try using src/native/build_via_cmake.sh.

# Windows: run the following cmds in cmd window.
setx /m ANDROID_SDK_ROOT "/path/to/sdk"
setx /m ANDROID_NDK_ROOT "/path/to/ndk"
# TODO: build_via_cmake.bat

# macOS & Linux: add the following two lines to ~/.bash_profile, and then source ~/.bash_profile or reopen the terminal
export ANDROID_SDK_ROOT="/path/to/sdk"
export ANDROID_NDK_ROOT="/path/to/ndk"
# 1. in file src/native/build_via_cmake.sh, change XCRASH_OUTPUT_DIRECTORY as you wanted 
# 2. call src/native/build_via_cmake.sh in any dir 

Support

  1. Check the xcrash-sample.
  2. Communicate on GitHub issues.
  3. Email: [email protected]
  4. 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.

About

🔥 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.

Resources

License

Unknown, CC-BY-4.0 licenses found

Licenses found

Unknown
LICENSE
CC-BY-4.0
LICENSE-docs

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 77.7%
  • Java 21.8%
  • Other 0.5%