deprecated warning while compiling

For me the best solution is add this lines in the file build.gradle(project:appname)

allprojects {
tasks.withType(JavaCompile) {
    options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}

Then all the deprecated methods in the java files appear in the build tab: deprecated api tab android studio

This works on gradle 5.1.1


Select Analyze > Inspect Code to run lint on your project. It should detect any deprecated methods, as well as others common mistakes in your project.

You can select "Run inspection by name" and there you can find "Deprecated API usage" (Java / Code maturity issues).