How to add -Xlint:unchecked to my Android Gradle based project?

This is what worked for me:
(in your project’s build.gradle)

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

Leave a Comment