Migrate from sentry-android-gradle-plugin 1.x to 2.0.0

Learn about migrating from Sentry Android Gradle Plugin 1.x to 2.0.0.

The io.sentry.android.gradle >= 2.0.0 requires Android Gradle Plugin >= 4.0.0.

The io.sentry.android.gradle >= 2.0.0 must be applied to the app/build.gradle module (or the module that has com.android.application plugin applied).

The io.sentry.android.gradle >= 2.0.0 publishes the Gradle Plugin Marker to Maven Central. As a result, you no longer need to set the classpath.

Old:

Copied
buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'io.sentry:sentry-android-gradle-plugin:{version}'
    }
}

apply plugin: 'io.sentry.android.gradle'

New:

Copied
plugins {
    id "io.sentry.android.gradle" version "{version}"
}

buildscript {
    repositories {
        mavenCentral()
    }
}

The io.sentry.android.gradle has been rewritten in Kotlin. As a result, the Groovy or Kotlin DSL syntax has slightly changed.

The autoProguardConfig flag has been removed, the Android SDK >= 2.0.0 version already merges the ProGuard rules automatically.

Old:

Copied
sentry {
    autoProguardConfig false
    autoUpload true
    uploadNativeSymbols false
    includeNativeSources false
}

New:

Copied
sentry {
    autoUpload = true
    uploadNativeSymbols = false
    includeNativeSources = false
}
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").