How to setup Smartlook Crash Reports.
Minimum supported Android version
The minimum supported Android version is Jelly Bean (API 18)
Installation
Step 1: Add the Smartlook SDK
If you haven't already, add Smartlook SDK to your Android project as described here.
Step 2: Add the Smartlook Crash Reports plugin to your app
- In your project-level Gradle file, add the Crash Reports Gradle plugin as a buildscript dependency:
buildscript {
repositories {
...
}
dependencies {
...
// Add the dependency for the Smartlook Crash Reports Gradle plugin
classpath 'com.smartlook:smartlook-crash-gradle-plugin:1.0.1'
}
}
- In your app-level
build.gradle
file, apply the Crash Reports Gradle plugin:
plugins {
id 'com.smartlook.crash-gradle-plugin'
}
- In the same
build.gradle
file, define the configuration for the plugin and include in your Smartlook API token:
smartlookCrashGradlePlugin {
apiKey = "your-smartlook-api-token"
force = true
}
In order to upload the mapping file, the REST API token is needed. How to create/get it is described in Creating API tokens.
Step 3: Force a test crash to finish setup
To finish setting up Crash Reports and see initial data in the Crash Reports of the Smartlook console, you need to force a test crash.
- Add code to your app that you can use to force a test crash.
You can use the following code in your app's MainActivity to add a button to your app that, when pressed, causes a crash. The button is labeled "Test Crash".
crashButton.setOnClickListener {
throw RuntimeException("Test Crash") // Force a crash
}
crashButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
throw new RuntimeException("Test Crash"); // Force a crash
}
});
-
Build and run your app.
-
Force the test crash in order to send your app's first crash report.
-
Go to the Crash Reports dashboard of the Smartlook to see your test crash.
This can take a while.