I don\'t use Android Studio but I build everything from the command line using build.gradle
. I generate a Lint report like this:
./gradlew lint
This is an accepted answer but solved this with Gradle Java plugin as below.
Add java plugin to build.gradle
file if not added already.
plugins {
// Apply the java plugin to add support for Java
id "java"
}
Then add task compileJava and/or compileTestJava
based on your need to check deprecations for only java main source code or java test source code.
You can add various compile options as listed here
compileTestJava {
// options.incremental = true
// options.fork = true
// options.failOnError = false
options.compilerArgs.add("-Xlint:deprecation")
}
Also, we can specify for the main and test sourcecode project as
tasks.withType(JavaCompile) {
options.compilerArgs.add("-Xlint:deprecation")
}