Android Gradle Plugin Reference
The Specto Gradle plugin synchronizes your application builds with the Specto dashboard.
On every build, and for every variant, it uploads the application ID, version name, and version code. If the application or its version don't exist in the Specto dashboard they are created automatically.
If the build is minified, the corresponding ProGuard mapping file is also uploaded, and a build ID is bundled with the application and linked to that particular mapping file. This is necessary in order to de-obfuscate function names in traces.
Installation
Apply the Specto Gradle plugin to your application module:
// Application module build.gradle
plugins {
id 'com.android.application'
id 'dev.specto.android.gradle' version '1.1.0'
}
If you are unable to use the plugins DSL you can instead use the buildscript
block:
// Top-level build.gradle
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}
dependencies {
classpath 'dev.specto:specto-android-gradle-plugin:1.1.0'
}
}
// Application module build.gradle
apply plugin: 'dev.specto.android.gradle'
Ensure that the Specto API key is set inside the application
element of your manifest:
// AndroidManifest.xml
<manifest …>
<application …>
<!-- … -->
<meta-data
android:name="dev.specto.API_KEY"
android:value="<YOUR_API_KEY>" />
</application>
</manifest>
You can find your API key when creating a new project in the Specto dashboard, or later in the project settings page.
Basic Configuration
By default the plugin automatically uploads information for each build variant.
You can disable the plugin completely via the specto
extension:
// build.gradle
specto {
enabled = false
}
You can also disable it selectively based on the variant:
// build.gradle
specto {
variantFilter { variant ->
// Disables the plugin for all debug builds.
enabled = !variant.name.toLowerCase().contains("debug")
}
}
Note: If your application has multiple variants with different application IDs, they will appear as separate applications in the dashboard.
This enabled property only affects Specto's Gradle plugin, not the Specto runtime. Disabling the Gradle plugin will prevent new application versions from being properly registered with Specto during the build phase, but it does not disable the runtime data collection.
To disable the runtime, see Selectively Enabling the SDK.
Advanced Configuration
Fail on Errors
failOnErrors
stops the build when the plugin fails to upload the necessary build information to Specto. This is true by default. If disabled, errors will be logged but the build will proceed.
// build.gradle
specto {
failOnErrors = false
}
Updated about 1 year ago