运行程序报以下问题:
Build file '/Users/zhouruoqi/Documents/codes/jingbeifang/jimu/jiyu-app/app/build.gradle' line: 1
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'org.gradle.language.base.plugins.LifecycleBasePlugin']
> Cannot add task 'clean' as a task with that name already exists.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92)
... 102 more
Caused by: org.gradle.api.InvalidUserDataException: Cannot add task 'clean' as a task with that name already exists.
at org.gradle.api.internal.tasks.DefaultTaskContainer.duplicateTask(DefaultTaskContainer.java:215)
... 163 more
解决方法:
Android Studio's Gradle wrapper 已经定义了 clean
的 task,所以无需重复定义:删除Project目录下的 build.gradle
文件中
task clean(type: Delete) {
delete rootProject.buildDir
}
网友评论