Showing results for 
Show  only  | Search instead for 
Did you mean: 

The Dynatrace Android Gradle Plugin can only be applied to Android application projects


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: 

buildscript {

repositories {

dependencies {
apply(plugin = "com.dynatrace.instrumentation")
configure<> {
configurations {
create("sampleConfig") {
debug {
autoStart {

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?


Dynatrace Champion
Dynatrace Champion

Hey fnaku,


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 "" 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

plugins {

And I am using gradle 7.2


When I changed id("") to id("") in my module's build.gradle.kts then gradle task compileDebugUnitTestKotlin completes successfuly. But I don't want to change that.

Dynatrace Champion
Dynatrace Champion

This will need an RFE request to mod the grade plugin as per your requirement. Please raise a support ticket for same !!!😊


Dynatrace Champion
Dynatrace Champion

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.



i really wonder that if you've solved the issue? 

i've been experiencing the same problem for 2 days and i've searched everthing but i got no progress. 

Hey kasdev,
The Dynatrace Android Gradle plugin can only be used in projects that use the Android Gradle plugin to build an Android app. It is not possible to instrument an (independent) library project, because this use case is not supported by Dynatrace.

Can you share the exact error message? So we know the exact problem that the Dynatrace plugin detected.
You can also create a support ticket and the support team will help you troubleshoot the error message.

Featured Posts