Performance Monitoring for Android Applications
Tags: android, performance, monitoring, mobile
Published: 2021-03-19 01:40:15

Android is arguably the most ubiquitous operating system in the world. Whether it's a tablet, phone, folding phone, computer, TV, or IoT device, chances are you’ve interacted with Android OS. And to help developers get full visibility into how their customers experience Android's myriad applications, we’re extending [Performance](https://docs.sentry.io/platforms/android/performance/) to [Android](http://sentry.io/for/android). 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e2ggiexznj4vvmo2lmud.jpeg)

Being an Android developer means thinking through countless scenarios. If something goes wrong, you need to imagine what that support ticket would look like. That means collecting everything from hardware model to software version, in addition to crucial details like screen orientation and battery level. Sentry provides all of that context out of the box — and has done so for some time. And if your users lose their connection while encountering an error, Sentry still captures these events so they can be reported back when the app restarts.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uq81gcdlr27i3lg4tlb3.png)

But errors are only half of the story. Android developers also need to see how their application performs. That means visibility into when a user writes to disk, fetches media, or loads an object in a given viewport. Without this data, untreated performance problems run the risk of becoming serious errors. But now that you have Sentry’s performance monitoring, you can finally connect your user’s frustrated taps to its poor-performing backend call.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lzxk90wu84wyk8v5avgw.png)

To install the Android SDK, add it to your `build.gradle` file:

```groovy
// Make sure mavenCentral is there.
repositories {
    mavenCentral()
}

// Enable Java 1.8 source compatibility if you haven't yet.
android {
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}

// Add Sentry's SDK as a dependency.
dependencies {
    implementation 'io.sentry:sentry-android:4.3.0'
}
```

After you’ve completed setting up a project in Sentry, we'll give you a value — which we call a DSN or Data Source Name — to add to your `AndroidManifest.xml` file.

```html
<application>
  <meta-data android:name="io.sentry.dsn" android:value="https://example@sentry.io/example" />
</application>
```

The current version of our Android SDK supports [auto instrumentation](https://docs.sentry.io/platforms/android/performance/included-instrumentation/) activity rendering, which can be expanded on through [custom instrumentation](https://docs.sentry.io/platforms/android/performance/custom-instrumentation/). Additionally, in the coming weeks, you’ll be able to automatically create spans for active transactions as well as record [breadcrumbs](https://docs.sentry.io/platforms/android/enriching-events/breadcrumbs/) for outgoing HTTP requests.

iOS developers: if you’re getting SDK envy, rest easy knowing that Performance is on the way for you as well. 

Have a friend who wants to manage releases, solve issues faster, and speed up their mobile applications? [Refer](https://sentry.io/referrals/mobile/) them to Sentry and we’ll give them — and you — three free months on our Team plan.

To start using Sentry with Android, configure the [SDK](https://docs.sentry.io/platforms/android/). And if you’re new to Sentry, you can try it for [free](https://sentry.io/orgredirect/try-business/) today.