Search code examples
androidandroid-studiolintgradlew

./gradlew lint says "no issues", but Analyze -> Inspect Code finds issues


I´m having a weird problem in Android Studio: The manually started linter via

Analyze -> Inspect Code -> "Whole project"

Finds some issues, however if I do it

./gradlew lint

in the console, it says

Ran lint on variant release: 0 issues found

Ran lint on variant debug: 0 issues found

I have no lintOptins in my gradle file, but use a lint.xml, here it is:

<?xml version="1.0" encoding="UTF-8"?>
<lint>
  <issue id="all">
    <ignore path="build" />
  </issue>
  <issue id="all">
    <ignore path="businesslogic/build" />
  </issue> 
</lint>

My question: How to make console show same errors as Inspection in android studio?


Solution

  • gradlew lint and Analyze -> Inspect Code are basically two different checks

    AndroidStudio runs a much more sophisticated set of checks than the gradle lint

    To see the list of checks performed by Android studio you can see here http://tools.android.com/tips/lint-checks This means your code will go through lot more inspections in AndroidStudio Inspect than gradlew lint

    If you still need the results to be same , you would have to deactivate any additional checks, which are not included in the set of predefined lint checks