Integrating Specto using Gradle

πŸ“˜

Specto supports integration using Gradle versions 5.4.1 to 7.0, and Android Gradle Plugin versions 3.5.0 to 4.1.1.

Add the Gradle plugin

Specto uses a Gradle plugin to upload application metadata (application ID, version, etc.) to our service. If your builds are minified, the plugin will also upload the ProGuard mapping file so that we can deobfuscate function names. To add the Gradle plugin to your project:

  1. Open your application module's build.gradle
  2. Add the dev.specto.android.gradle plugin:
plugins {
    id 'com.android.application'
    id 'dev.specto.android.gradle' version '1.1.0'
}
Adding the Specto plugin to your application module's build.gradle (steps 1-2)Adding the Specto plugin to your application module's build.gradle (steps 1-2)

Adding the Specto plugin to your application module's build.gradle (steps 1-2)

Add the library

  1. Open the build.gradle for each module that you want to collect performance data from
  2. Add dev.specto:specto-android-core as a dependency:
dependencies {
    // …
    implementation 'dev.specto:specto-android-core:1.1.0'
}
Adding the Specto library as a dependency in build.gradle (steps 1-2)Adding the Specto library as a dependency in build.gradle (steps 1-2)

Adding the Specto library as a dependency in build.gradle (steps 1-2)

Set the API key

  1. Copy the API key that was automatically created upon sign up or create a new API key from the dashboard
  2. Open your application's AndroidManifest.xml
  3. Add the API key as meta-data inside the application element of the manifest:
<manifest …>
    <application …>

        <!-- … -->

        <meta-data
            android:name="dev.specto.API_KEY"
            android:value="<YOUR_API_KEY>" />

    </application>
</manifest>
Setting the Specto API key in AndroidManifest.xml (steps 2-3)Setting the Specto API key in AndroidManifest.xml (steps 2-3)

Setting the Specto API key in AndroidManifest.xml (steps 2-3)


What’s Next

Follow the quick start guide to configure the Specto SDK and collect your first performance metrics.