Manual instrumentation for Android

To manually instrument your Android app

Include the OneAgent library as dependency to your project. OneAgent for Android is hosted on JCenter and MavenCentral.

dependencies {
  implementation 'com.dynatrace.agent:agent-android:+'

Now Gradle automatically ensures that the OneAgent library is added to your project, the permissions are updated and the OneAgent library is excluded from obfuscation and optimization.

Use the startup method to initialize, configure and start OneAgent as shown below. It's recommended that you start OneAgent in the onCreate method from your application class.

public class YourApplication extends Application {

    public void onCreate() {
        Dynatrace.startup(this, new DynatraceConfigurationBuilder("<YourApplicationID>", "<YourEnvironmentID>", "<ProvidedClusterUrl>")
            ... // additional configuration

Go to the Instrumentation page of your mobile application in Dynatrace to obtain the correct values.

Use OneAgent SDK for Mobile to enrich mobile user experience data


  • OneAgent doesn't contain a specific web request tagging and timing API for 3rd-party web request frameworks. You have to use the general API methods (for example, Dynatrace.getWebRequestTiming(String)).
  • There is limited support for multi-process applications, as each process starts its own OneAgent and has its own session number.