Setup (Android)

Reaper is an SDK that uses production data for detecting dead code. See the emerge-android repo for more information.

Quick setup

Install the SDK

First, if you haven't already, you must install our Gradle plugin by following our setup guide. The Gradle plugin is used to instrument your application code.

Second, add an implementation dependency for the Reaper SDK:

Latest version: Maven Central

// app-module build.gradle.kts
dependencies {  

Configure the SDK

The SDK is what automatically sends dynamic analysis user sessions to our API. To send sessions we need to configure two settings within the reaper block: enabled and publishableApiKey.

  • enabled is a boolean property which controls whether the plugin instruments the bytecode during compilation.
  • publishableApiKey is a token included with reports uploaded from the field to Emergetools.
// app-module build.gradle.kts
plugins {

emerge {
  // ...snip...
  reaper {
    publishableApiKey.set("<PUBLISHABLE API KEY>")

Upload an .aab build

This is done automatically by the ./gradlew :<app>:emergeInitializeReaper<variant> Gradle task. Alternatively, you can manually upload the .aab via the UI.


Setup verification

Running the ./gradlew :<app>:emergeInitializeReaper<variant> Gradle task will notify you of any failing steps.

Manual initialization

By default Reaper uses the Jetpack startup library to automatically initialize itself however you may need to manually initialize Reaper. To manually initialize Reaper call Reaper.init(context). For example:

import com.emergetools.reaper.Reaper

class MyApp : Application() {
  override fun onCreate() {
import com.emergetools.reaper.Reaper;

public class MyApp extends Application {
  public void onCreate() {

A common case when manual initialization is required is when androidx.startup.InitializationProvider has been globally disabled by the following snippet being included in the AndroidManifest.xml:

    	tools:node="remove" />