The Dynatrace Android Gradle plugin adds its own Gradle task to the Android build. When the customer rebuilds the application Gradle ensures that our tasks are executed. The plugin auto-instruments the ".class" after they are compiled and before they are transformed into ".dex" files.
The following illustration shows how Android compiles the source code and where the Dynatrace Android Gradle plugin auto-instruments the application:
Source: https://developer.android.com/studio/releases (24.01.2020)