How to suppress Android Lint warning in Gradle script

friederbluemle picture friederbluemle · Jul 4, 2014 · Viewed 8.5k times · Source

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?

Answer

matiash picture matiash · Jul 5, 2014

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.

enter image description here