发现任务“:app:spotlessJava”(类型 'SpotlessTask')的配置存在问题。 gradle 7 次更新后
A problem was found with the configuration of task ':app:spotlessJava' (type 'SpotlessTask'). after gradle 7 update
我已经更新到 gradle 7.0.0 并且有这样的错误:
**
A problem was found with the configuration of task ':app:spotlessJava'
(type 'SpotlessTask').
- Type 'com.diffplug.gradle.spotless.SpotlessTask' property 'target' is missing an input or output annotation.
**
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath 'com.google.gms:google-services:4.3.8'
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.24.2"
// Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
project.tasks['preBuild'].dependsOn 'generateContactsXml'
apply plugin: "com.diffplug.gradle.spotless"
spotless {
java {
target '**/*.java'
googleJavaFormat('1.6').aosp()
removeUnusedImports()
}
}
project.tasks['preBuild'].dependsOn 'spotlessApply'
您的 Spotless 插件太旧,无法在 Gradle 上 运行 7. 您必须升级它。 https://github.com/diffplug/spotless/issues/880
我已经更新到 gradle 7.0.0 并且有这样的错误: **
A problem was found with the configuration of task ':app:spotlessJava' (type 'SpotlessTask').
- Type 'com.diffplug.gradle.spotless.SpotlessTask' property 'target' is missing an input or output annotation.
**
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath 'com.google.gms:google-services:4.3.8'
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.24.2"
// Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
project.tasks['preBuild'].dependsOn 'generateContactsXml'
apply plugin: "com.diffplug.gradle.spotless"
spotless {
java {
target '**/*.java'
googleJavaFormat('1.6').aosp()
removeUnusedImports()
}
}
project.tasks['preBuild'].dependsOn 'spotlessApply'
您的 Spotless 插件太旧,无法在 Gradle 上 运行 7. 您必须升级它。 https://github.com/diffplug/spotless/issues/880