❗️ Android SDK only catches java related downtime

To capture C++ downtime, see the Android NDK Access Guide documentation

# Access Guide

# 1.Tool download

Click Download Android SDK on the SDK download page。

# 2. Import dependency files

Copy the [Crasheye.jar] file in the downloaded compressed package to your project [libs] directory, and then expand the [libs] folder in the Android Studio project, you can see the [Crasheye.jar] file you just copied in, right click, select [Add As Library...], the import is successful.

# 3. Configure the configuration AndroidManifest.xml file

Configuration required to add the SDK in the [AndroidManifest.xml] file

Permission configuration (required)
Channel information (optional)

<!--Permission configuration, required> 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> 
<uses-permission android:name="android.permission.READ_PHONE_STATE"/> 
<uses-permission android:name="android.permission.READ_LOGS" /> 

<application ……>
    <activity ……/>
    <!--channel info, optional>
    <meta-data android:name="CRASHEYE_CHANNEL" android:value="Your_Channel"/>

# 4. Initialize the SDK

Crasheye only needs to add one line of code to complete the monitoring of APP exceptions.


💡 It is recommended to add this initialization code after Application.on Create () or MainActivity.on Create ().

public void onCreate(Bundle savedInstanceState) {
    Crasheye.init(this, "Your_AppKey");


👍 At this point, the SDK access on Android is complete

# 5. Testing

Please debug and verify on the real machine, and you can see the monitoring data in real time in the background of Crasheye.

Launch your app and you can see the output "init success!" in LogCat, as shown below:

# Common API

# Crasheye.setChannelID

Set channel information

  • You can configure the channel number information in the AndroidManifest.xml file, Crasheye will automatically read the information of your configuration and report it, see Configuration AndroidManifest.xml file.
  • If you do not want to write channel information in the AndroidManifest.xml, you can also set it by calling the API directly. The code example is as follows:
public void onCreate(Bundle savedInstanceState) {
    Crasheye.init(this, "Your_AppKey");

# Crasheye.setAppVersion

Set App Version Number

  • Crasheye will read the android: versionName version number information configured in the AndroidManifest.xml by default. Of course, you can also set it yourself by calling the API:
public void onCreate(Bundle savedInstanceState) {
    Crasheye.init(this, "Your_AppKey");

# Crasheye.setFlushOnlyOverWiFi

Settings are only reported in Wifi environment

  • In order to save users' network traffic in non-wifi environments, Crasheye provides an interface to make the stack information after the crash only reported when the phone is connected to Wifi:
public void onCreate(Bundle savedInstanceState) {
    /* true:Report only under wifi;
     * false:All networks are reported.
     * The default value is false
     Crasheye.init(this, "Your_AppKey");

# Crasheye.setUserIdentifier

Set user ID Setting a user ID for each reported record can facilitate later screening and positioning of problems. For example, developers who want to see the crash information reported by their mobile phone can use this method:

Crasheye.setUserIdentifier(String userIdentifier);

# Crasheye.setLogging

Set collection log

  • This interface mainly collects running logcat logs. When an exception is found, the collected log information will be saved and uploaded to the server together; (the interface supports collecting the latest log logs of up to 1000 rows)
* Set to get the log log to get the number of rows and the keywords to get
* @param lines        The number of rows obtained (maximum collection of 1000 rows)
* @param filter        Keyword obtained (optional). For example, if the filter is "Crasheye", it is equivalent to entering "logcat -d Crasheye" in the LogCat filter bar
Crasheye.setLogging(int lines, String filter);

# Crasheye.leaveBreadcrumb

Add breadcrumbs (RBI information)

  • You can add multiple breadcrumbs (RBI information) to your code and view the time and order of breadcrumbs (RBI information) on the Crasheye platform, so you can monitor whether your project runs according to your presets! Just call the following APIs in every place you want to monitor:
Crasheye.leaveBreadcrumb(String breadcrumb);

# Crasheye.addExtraData

Add custom data

  • If you feel that the data captured by Crasheye by default is not enough to meet your requirements, you can add custom data by just calling the following APIs:
Crasheye.addExtraData(String key, String value);

# Crasheye.sendScriptException

Active reporting script information interface

  • This interface is mainly for developers to actively call. When the caught exception stack information, such as script exceptions such as: lua, js, etc., can be reported to the server level by calling the interface. (In order to reduce repeated reports, the same exception information can only be reported once within 10 minutes)
* Script reporting interface
* @param errorTile The title of the error script
* @param stacktrace stack information
* @param language scripting language
Crasheye.sendScriptException(String errorTitle, String stacktrace, String language);

# Crasheye.getCrasheyeUUID

Get device ID information

  • This interface allows the user to obtain the device ID information of the current mobile phone. Through this device ID information, you can search through the page to find the corresponding machine abnormality information.

# Crasheye.setIsBetaVersion

Set up a test version

* Set whether this version is a test version
* @param isBeta Is it a beta version
Crasheye.setIsBetaVersion(boolean isBeta)

# Mapping file upload

# mapping.txt file

https://developer.android.com/studio/build/shrink-code#native-crash-support (opens new window)
mapping.txt File default path

<Project folder>/app/build/outputs/mapping/release/mapping.txt

Why do I need to upload a Mapping file?
The mapping file is used to cooperate with the [symbol file] to parse the stack information uploaded by the SDK. The uploaded stack information is difficult to understand and needs to be parsed before it can be understood.。

# Upload tool

  1. Environmental requirements Java SE Runtime Environment 7 (opens new window) Or more
  2. Prepare

Download Mapping File Upload Tool

  1. Run the upload tool with the following parameters:
Parameters Description
-appkey appkey for the project
[-veresion] App version (optional), read from project AndroidManifest.xml by default
[-AndroidManifestPath] AndroidManifest.xml path (used to read the application version number, mutual exclusion with the -version parameter) (optional)
Symbol file path D:\ AndroidProject\ libslua.so (C/C ++ code is used in the android project and will be generated during construction. The specific file path depends on the file path after the project is generated)
[-mapping] mapping.txt file path
Java -jar CrasheyeAndroidSymbol.jar -appkey = AppKey of the project [-version = application version number] [-AndroidManifestPath = AndroidManifest.xml path] symbolic text
Piece path -mapping = mapping.txt file path
  1. Upload successful

# Website upload

  1. Settings - Symbol File - Mapping File Upload
  2. Select the app version
  3. Upload the Mapping file through the web page
Last Updated: 9/13/2023, 2:06:01 PM