不支持不必要地替换不存在的任务 [英] Unnecessarily replacing a task that does not exist is not supported
问题描述
AILURE:构建因异常而失败.
AILURE: Build failed with an exception.
-
其中: 初始化脚本'C:\ Users \ User \ AppData \ Local \ Temp \ Console_main __.gradle'行:18
Where: Initialization script 'C:\Users\User\AppData\Local\Temp\Console_main__.gradle' line: 18
出了什么问题: 配置根项目"demo"时出现问题.
What went wrong: A problem occurred configuring root project 'demo'.
无法创建任务':Console.main()'. 不支持不必要地替换不存在的任务.直接使用create()或register()即可.您试图替换名为"Console.main()"的任务,但是没有现有名称相同的任务.
Could not create task ':Console.main()'. Unnecessarily replacing a task that does not exist is not supported. Use create() or register() directly instead. You attempted to replace a task named 'Console.main()', but there is no existing task with that name.
尝试: 使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行,以获取更多日志输出.与--scan一起运行以获得完整的见解.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
在236毫秒内失败 10:32:59 PM:任务执行已完成'Console.main()'.
BUILD FAILED in 236ms 10:32:59 PM: Task execution finished 'Console.main()'.
推荐答案
清除缓存,然后再次启动应用程序.最近升级gradle时可能会发生这种情况. 如果您了解intellij的想法,请选择文件->使缓存无效并重新启动.
Clear the cache and start the app again. This might happen when you recently upgraded gradle. If you are on intellij idea then choose file -> invalidate cache and restart.
如果您正在使用gradle,请删除.gradle文件夹,然后再次运行gradle.
If you are using gradle then delete your .gradle folder and run gradle again.
这篇关于不支持不必要地替换不存在的任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!