I'm using Android Studio 1.5.1. I'd like to receive a build failure if a deprecated API is used. Currently I change the error level in the settings but the build gives me just a warning. I tried to put in gradle file:
lintOptions {
abortOnError true
}
but it doesn't work. Is there any code I can use in the gradle file or any option?
In your root build.gradle
, try:
allprojects {
tasks.withType(JavaCompile) {
options.deprecation = true
options.compilerArgs += ['-Werror']
}
}
Works for me on Android Studio 2.2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With