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 MavenCentral.

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

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 the OneAgent in the onCreate method from your application class. If your app supports Direct Boot please make sure that the Dynatrace.startup is never called from a Direct Boot aware component.

public class YourApplication extends Application {

    public void onCreate() {
        Dynatrace.startup(this, new DynatraceConfigurationBuilder("<YourApplicationID>", "<ProvidedBeaconUrl>")
            ... // 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.
  • The agent does not support Direct Boot mode. You have to manually startup the agent once the device is unlocked.