How to recompile with -Xlint:deprecation How to recompile with -Xlint:deprecation android android

How to recompile with -Xlint:deprecation


To answer my own question, you need to add the following to your project-level build.gradle file:

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


Just an update from me since I ran into this issue recently:

You can get the details for this deprecation issue by doing as @Andreas suggested in the accepted answer. If you're using Kotlin, the real solution is (in build.gradle):

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

One other solution is to update your AndroidSDK. The issue is with an SDK method overriding a deprecated feature. In your build.gradle file you can change the compileSdkVersion:

android {    compileSdkVersion 29 //Change this to the latest release    ...    ...    defaultConfig {        ...        targetSdkVersion 29 //Change this too        ...    }}

Using the latest SDK version will likely fix your issue. Android does a good job of fixing deprecation issue between releases. If it persists, you might just need to wait until the next SDK release. If the issue isn't in the AndroidSDK but instead in a package you've downloaded, you should see if the package needs upgrading or contact the manager of that package.


I have added in-app level build.gradle and resolved issue

aaptOptions { cruncherEnabled = false }