【问题标题】:Gradle : Cannot add task ‘:helloFromBuild1′ as a task with that name already existsGradle:无法添加任务':helloFromBuild1',因为具有该名称的任务已经存在
【发布时间】:2015-08-29 05:10:59
【问题描述】:

Gradle 在终端中给出以下错误。

* What went wrong:
A problem occurred evaluating script.
> Cannot add task ':helloFromBuild1' as a task with that name already exists.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

【问题讨论】:

  • 您需要提供更多上下文来解决这个问题。你的构建脚本是什么样子的?
  • @Rene,请看我的回答。

标签: gradle


【解决方案1】:

任务名称冲突可能是由于文件导入不当造成的。如需更好的解释,请参阅这篇文章Gradle : Cannot add task ‘:helloFromBuild1’ as a task with that name already exists.

上述链接中解决方案的一小段摘录如下:

解决方案:

如果你想同时导入 build_1.gradle 和 build_2.gradle 的任务 在 build_3.gradle 然后在上述情况下,您只能通过 在 build_3.gradle 中导入 build_2.gradle,因为任务 build_1.gradle 已经包含在 build_2.gradle 中。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-21
  • 2014-04-04
  • 2019-08-02
相关资源
最近更新 更多