Android
We released Performance-V2 , a set of experimental features to give you more details about app start performance and frame delay on a span level.
We released Source Context, which shows snippets of code around the location of stack frames.
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 project established? Head over to sentry.io, then return to this page.
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 project directory:
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 auth token 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.
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.
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 project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.
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").
- Package:
- maven:io.sentry:sentry-android
- Version:
- 7.8.0
- Repository:
- https://github.com/getsentry/sentry-java
- API Documentation:
- https://javadoc.io/doc/io.sentry