I tried to add the following to the root build.gradle
file:
subprojects {
gradle.projectsEvaluated {
tasks.withType(Compile) {
I'm not sure the problem was about using the Gradle subprojects
configuration parameter, but the syntax you used:
options.compilerArgs << "-Xlint:unchecked -Xlint:deprecation"
This worked for me:
subprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs += [
'-Xlint:unchecked', // Shows information about unchecked or unsafe operations.
'-Xlint:deprecation', // Shows information about deprecated members.
]
}
}
}
or
subprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
If you only want to add one option (you would normally add more), inside the task JavaCompile
you just need to add:
options.compilerArgs << "-Xlint:unchecked"
You can find more information about Lint here and here.