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

2

10

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?

Desex answered 23/8, 2017 at 8:37 Comment(1)
#26223165Decile
S
6

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

Secretarial answered 30/8, 2017 at 14:47 Comment(1)
Any proof that they are different? and what all additional checks does the inspect code performs?Nostalgia
A
1

See Difference between running lint via Android Studio menu and gradlew command-line

Basically, these are different tools so they have different inspections to check.

You might be able to set up gradle lint command to call the IntelliJ inspect.sh shell script. See the answer in that question.

Alpha answered 25/8, 2017 at 17:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.