Recompile with -Xlint in Android Studio
Avoiding deprecated APIs is a good habit. Plus, clean build output is always nice :)
When you build an app, the Java compiler may report that some input files use unchecked or unsafe operations, or use or override a deprecated API:
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.As the messages suggest, we can recompile with -Xlint:unchecked and -Xlint:deprecation to get more details about these warnings.
Open the app module’s build.gradle file:

App module’s build.gradle file
Add an allprojects {} block if one isn’t already present. Inside it, configure Gradle to pass the following compiler arguments to each JavaCompile task:
allprojects {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}Now, each time we build the app, we’ll see details about unchecked or unsafe operations and deprecated APIs used in our code.
Tip: If you need to keep using a deprecated API, you can suppress its deprecation warnings by adding the following annotation to the method that uses it:
@SuppressWarnings("deprecation")Related Posts
2017-03-16
2014-07-20
Comments 3
Thank you
Thank you.