【发布时间】:2019-11-22 08:48:16
【问题描述】:
这是我的build.gradle
buildscript {
ext {
...
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id "com.diffplug.gradle.spotless" version "3.26.0"
}
allprojects {
repositories {
google()
jcenter()
}
}
spotless {
kotlin {
target "**/*.kt"
ktlint(ktlintVersion).userData(['max_line_length' : '100'])
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
原来编译成功,但是在引入spotless的时候,导致了这个错误:
com.diffplug.gradle.spotless && task clean(type: Delete){} Error:Cannot add task 'clean' as a task with that name already exists
所以,我猜这两个部分是冲突的,但我不知道具体原因。
plugins {
id "com.diffplug.gradle.spotless" version "3.26.0"
}
//...
task clean(type: Delete) {
delete rootProject.buildDir
}
【问题讨论】:
标签: android android-studio build.gradle gradle-plugin