In our android project we are implementing dynatrace. I followed steps from this link: Instrumentation via plugin and my root build.gradle.kts looks like this:
apply(plugin = "com.dynatrace.instrumentation")
Project builds fine but now I noticed when I try to run gradle task for example compileDebugUnitTestKotlin from module other than my app module I get error The Dynatrace Android Gradle Plugin can only be applied to Android application projects.
All I could find on this is this entry in FAQ: FAQ entry but it doesn't help me at all because my project is in fact Android project. Why is this gradle task failing with this error and how can I fix that?
this error message should only be shown, when there is no "app" subproject/module in your Gradle project. The Dynatrace Android Gradle plugin checks if the "com.android.application" plugin is applied.
What is the "module type" of the other module (for example: Android library, Dynamic feature module, ...)?
What Gradle version are you using?
I would recommend to create a support ticket. Then you can upload the build files (and upload the Gradle debug logs). With this information we can troubleshoot your problem.
Dynatrace also provides a second plugin, where you can directly instrument the Android app module. But then the plugin configuration is not shared between different modules. For more information see
My other modules are Android library
And I am using gradle 7.2
When I changed id("com.android.library") to id("com.android.application") in my module's build.gradle.kts then gradle task compileDebugUnitTestKotlin completes successfuly. But I don't want to change that.
This will need an RFE request to mod the grade plugin as per your requirement. Please raise a support ticket for same !!!😊
In my project the task ":lib:compileDebugUnitTestKotlin" works and there is no error message from the Dynatrace Android Gradle plugin. Having library modules in your Android project is supported.
As written in my last comment, we would need more information from your Android project to understand the project setup and determine why the plugin believes you do not have an application module.