Android SDK is for java related crashes only. Please refer to Android NDK integration guideline for C++ related crashes.

Create A New App and Get The AppKey

Once you register and log in Crasheye, you can create your own app. Every app will have a unique AppKey to initialize the SDK, and to identify your app as well. ( Download Sample )

Create new app:

1. Log in Crasheye to access admin panel.
2. Click the profile picture at the upper right corner of the page, and select [my apps] in the popup menu to access the list of your app.
3. Click [new] in app list page.
4. Name your app and choose a platform in the popup box. Click [yes]. A new app is created.

Keep your unique AppKey secured from misuse.

Download SDK

Click Download Android SDK in SDK download page.

Import Dependent File

Copy [Crasheye.jar] from the downloaded SDK to [libs] folder in your project, and then open [libs] folder in Android Studio project. You will see the copied [Crasheye.jar] in it. Right click on it and select [Add As Library...] to import the file..

Configuration

Configure permission settings (required) and channel information (optional) in AndroidManifest.xml, as demonstrated in the following code sample:

<!--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 Information, Optional>
    <meta-data android:name="CRASHEYE_CHANNEL" android:value="Your_Channel"/>
</application>

Initialize SDK

Import header file first:

import com.xsj.crasheye.Crasheye;

One single line of code ensures that Crasheye monitors app crash in real time.

It is recommended that initialization should be added in Application.onCreate()or MainActivity.onCreate(), as demonstrated in the following code sample:

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

    super.onCreate(savedInstanceState);
}

Your Android app is now integrated with Crasheye.

Test

Please test on a real device. If successful, data will be shown in admin panel in real time.

Start your application. You will see "init success!" and "ndk creah handler init success" shown on LogCat:

Channel ID

You can set Channel ID in AndroidManifest.xml; Crasheye will read the settings and report to the server. Read more: Configuration

You can also call an API to set Channel ID without adding channel information in AndroidManifest.xml, as demonstrated in the following code sample:

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

    super.onCreate(savedInstanceState);
}

App Version

By default, Crasheye will read version information from android:versionName in AndroidManifest.xml. Of course you can also set app version by calling API.

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

    super.onCreate(savedInstanceState);
}

Upload via Wifi Only

In order to save the cellular data usage for the users, Crasheye offers an API to report stack trace of crashes only when the device is on wifi networks.

@override
public void onCreate(Bundle savedInstanceState) {
    // true:Report via WIFI only; false: Report via whatever connected network. Default value is false.
    Crasheye.setFlushOnlyOverWiFi(true);
    Crasheye.init(this, "Your_AppKey");

    super.onCreate(savedInstanceState);
}

User Identification

You can assign User Identification to each reported issue to help filter and locate issues. Developer can use this method to filter crash issues reported by his own device.

Crasheye.setUserIdentifier(String userIdentifier);

Log Collection

This API collects logs (LogCat) in runtime. When exception occurs, the collected logs will be saved and reported to server. (Maximum 1000 lines of the latest logs)

/**
* Set line limit and keyword to access logs
* @param lines	: lines of codes collected (1000 lines in maximum)
* @param filter	: Keyword(require = false), for example, using Crasheye as keyword is equivalent to entering "logcat -d Crasheye" in Logcat filter
*/
Crasheye.setLogging(int lines, String filter);

Breadcrumb (Navigation Information)

By leaving breadcrumbs (navigation information), you can capture the time and sequence of crashes and handled exceptions to keep track of if your app is working as intended. Call the following API where you want to monitor:

Crasheye.leaveBreadcrumb(String breadcrumb);

Developer-Defined Text String

In case that you want to capture more data than the default setup does, you can call this API to add developer-defined text string to collect more information:

Crasheye.addExtraData(String key, String value);

Report Script Exception

This API is for the convenience of developers. The caught exceptions of stack trace, such as lua and js script exception, will be reported to server. (In order to reduce repetitive reports, the same exception will only be reported once in 10 minutes)

/**
* Script exception reporting interface
* @param errorTile : title of script exception
* @param stacktrace : stack trace
* @param language : script language
*/
Crasheye.sendScriptException(String errorTitle, String stacktrace, String language);

Device ID

Device ID is accessible via this API. Users can filter the logs with device ID to find the matched exceptions of the device.

Crasheye.getCrasheyeUUID();

Set Beta Version
/**
* Set whether the version is the beta
* @param isBeta : true is beta version
*/
Crasheye.setIsBetaVersion(boolean isBeta)
1. Environment

Java SE Runtime Environment 7  or later

2. Preparation

a. Download Upload tool
b. mapping.txt file path:

<project folder>/app/build/outputs/mapping/release/

3. Mapping file Upload

Via website:

1. Settings -> Symbols -> Mapping File Upload
2. Select a matched app version
3. Upload mapping file via website

Via upload tool:

1. Start the mapping file upload tool, and use the following command to upload:

Parameters Meaning
-appkey Appkey of the project
[-veresion] app version (optional), read from AndroidManifest.xml by default
[-AndroidManifestPath] AndroidManifest.xml file path (to get app version, being mutually exclusive with the parameter -version) (optional)
[-mapping] mapping.txt file path
java -jar CrasheyeAndroidSymbol.jar -appkey=project's AppKey [-version=App version] [-AndroidManifestPath=AndroidManifest.xml path] -mapping=mapping.txt