I have the following annoying warning in my Android Lint report:
Gradle Dependency: Obsolete Gradle Dependency
A newer version of com.android.support:appcompat-v7 than 20.+ is available: 21.0.0-rc1
The problem is I cannot use 21.0.0-rc1 because it does not work with my project. How can I suppress the warning?
To suppress a lint warning with an annotation, add a @SuppressLint("id") annotation on the class, method or variable declaration closest to the warning instance you want to disable.
Current projectPosition your cursor on the if statement and press Alt + Enter . Then choose Simplify > Disable inspection.
android.annotation.SuppressLint. Indicates that Lint should ignore the specified warnings for the annotated element.
The Gradle Lint plugin is a pluggable and configurable linter tool for identifying and reporting on patterns of misuse or deprecations in Gradle scripts and related files.
You can disable lint warnings in Gradle. In this case:
android {
lintOptions {
disable 'GradleDependency'
}
...
To disable the warning for a specific dependency, you can instead use the noinspection
hint just above the line that causes the warning. Like this:
//noinspection GradleDependency
compile 'com.android.support:appcompat-v7:20.+'
In Android Studio, you can turn off the "Obsolete Gradle Dependency" warning in Settings -> Project Settings -> Inspections.
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