简体   繁体   English

在build.gradle中覆盖任务

[英]Override Task in build.gradle

How to override a task in build.gradle ? 如何覆盖build.gradle的任务?

I trying to compile the build.gradle with the dependency Dynatrace , a conflict between task names is occurring. 我试图编译build.gradle与依赖Dynatrace ,任务名称之间的冲突发生。

Error: Cannot add task ':app:autoInstrumentDebug' as a task with that name already exists. 错误:无法添加任务':app:autoInstrumentDebug',因为该名称的任务已经存在。

I have checked my current tasks on build.gradle menu and don't have found any task with this path name. 我已经在build.gradle菜单上检查了我当前的任务,但没有找到任何使用此路径名的任务。

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! 我敢肯定您是同事会为您感到骄傲!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM