Android
We released Source Context, which shows snippets of code around the location of stack frames.
We just released a new Logcat integration, which automatically creates breadcrumbs for your android.util.Log.*
calls.
Using Jetpack Compose? Measure composition and rendering time of your @Composable
functions using our performance metrics for Jetpack Compose.
Let us know if you have feedback through GitHub issues.
On this page, we get you up and running with Sentry's SDK.
Don't already have an account and Sentry
Install
Sentry captures data by using an SDK within your application’s runtime.
We recommend installing the SDK through our installation wizard by running the following command inside your
brew install getsentry/tools/sentry-wizard && sentry-wizard -i android
The wizard will prompt you to log in to Sentry. It'll then automatically do the following steps for you:
- update your app's
build.gradle
file with the Sentry Gradle plugin and configure it - update your
AndroidManifest.xml
with the default Sentry configuration - create
sentry.properties
with an authtokenIn search, a key-value pair or raw search term. Also, a value used for authorization.to upload proguard mappings (this file is automatically added to.gitignore
) - add an example error to your app's Main Activity to verify your Sentry setup
After the wizard setup is completed, the SDK will automatically capture unhandled exceptions, and monitor performance. You can also manually capture errors.
If the setup through the wizard doesn't work for you, you can also set up the SDK manually.
Configure
Additional options can be found on our dedicated options page.
Here, you'll also be able to set context data, which includes data about the user, tags, or even arbitrary data, all of which will be added to every event sent to Sentry.
Verify
This snippet includes an intentional error, so you can test that everything is working as soon as you set it up.
If you're using automatic installation via the wizard, this step isn't necessary.
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import java.lang.Exception;
import io.sentry.Sentry;
public class MyActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
throw new Exception("This is a test.");
} catch (Exception e) {
Sentry.captureException(e);
}
}
}
Learn more about manually capturing an error or message in our Usage documentation.
To view and resolve the recorded error, log into sentry.io and open your
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
- Package:
- maven:io.sentry:sentry-android
- Version:
- 6.30.0
- Repository:
- https://github.com/getsentry/sentry-java