New way to install Android SDK with the Sentry Gradle plugin

Hey there!

We are happy to announce a new feature preview for Android - automated installation. By just applying the Sentry Android Gradle plugin, you will automatically get the Sentry Android SDK and integrations (such as okhttp, fragment and timber) installed.

The plugin cleverly detects if you’re using any of the mentioned libraries (e.g. it looks for com.squareup.okhttp3 on your classpath) before adding and configuring the respective Sentry dependency. No need to manually initialize the SDK or search for all of the OkHttpClient instances across your app to add the SentryOkHttpInterceptor - the plugin does all of that for you!

This is an example taken from one of our sample apps, where we just applied the Gradle plugin with the auto-install feature with no further configuration:

Start using it now - upgrade the Sentry Android Gradle plugin version to 3.1.0-alpha.1

buildscript {
    repositories {
        mavenCentral()
    }
}

plugins {
    id "io.sentry.android.gradle" version "3.1.0-alpha.1"
}

For the APM features such as okhttp/retrofit network requests and fragment lifecycle events
make sure to have performance monitoring enabled on the SDK site:

<application>
    <meta-data android:name="io.sentry.traces.sample-rate" android:value="1.0" />
</application>

That’s it! You can remove the existing runtime dependencies on io.sentry:sentry-android and integrations from your dependencies block. The auto-installation feature is enabled by default. Check official docs for more details.

We’re eager for your feedback - please, try this out and let us know if you encounter any issues or wish for more functionality.

1 Like