5

How to override a task in build.gradle ?

I trying to compile the build.gradle with the dependency Dynatrace, a conflict between task names is occurring.

Error: Cannot add task ':app:autoInstrumentDebug' as a task with that name already exists.

I have checked my current tasks on build.gradle menu and don't have found any task with this path name.

Imene Noomene
  • 3,035
  • 5
  • 18
  • 34
Gabriel Marcos
  • 100
  • 1
  • 1
  • 8

1 Answers1

12

I believe you should try overwriting the task (make sure to test well the App afterwards to avoid unwanted side-effects).

In order to you should do the following:

task(overwrite: true){
apply plugin: 'com.name.of.your.plugin'
plugin {
    defaultConfig {

    }
}}

I hope this helps you buddy! I'm sure you're coworkers will be very proud of you!

Augusto Knijnik
  • 144
  • 1
  • 3