How do I enable user experience monitoring for Android apps?

To set up user experience monitoring for your Android app, use Dynatrace auto-instrumentation. Auto-instrumentation automatically adds OneAgent for Mobile to your app and instruments your app without modifying its source code. Because auto-instrumentation modifies the byte-code of your mobile app after you generate the APK file, ensure that your instrumented app is signed with your Google Play certificate before you upload the instrumented APK to the Google Play store.


  • JAVA_HOME environment variable must point to a JDK 1.8

  • Operating System supported by Android Studio

  • Install ia32-libs on 64-bit Linux.

How to use auto-instrumentation

The easiest and fastest way to use auto-instrumentation is via the Dynatrace Gradle plugin. The Dynatrace Gradle plugin automatically triggers auto-instrumentation on every build. Because auto-instrumentation inserts OneAgent for Mobile start-up at the beginning of the application start procedure, you can't control the start-up sequence using OneAgent for Mobile SDK calls. OneAgent for Mobile ignores multiple start-up calls.

If you can't use the Dynatrace Gradle plugin because you don't build your app using the Android Gradle plugin, or the Dynatrace Gradle plugin is incompatible with your build script, then you can run the auto-instrumentation script from the command line.


  • Auto-instrumentation has to add OneAgent for Mobile code into the primary .dex file. There are some limitations for multi-dex applications.
  • Auto-instrumentation only monitors the native part of a hybrid application.
  • Avoid using special characters and spaces in file and path names (for example, ( ) [ ] $ % *).  If you're having trouble instrumenting your app, rename your file to use only alphanumeric characters (a-z, A-Z, 0-9) and the dot character (.) and try again.
  • APK protection tools (for example, DexGuard) aren't fully supported, this includes features like byte-code protection and tamper detection.