Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

./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?

like image 919
最白目 Avatar asked Aug 23 '17 08:08

最白目


2 Answers

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

like image 97
Aron_A Avatar answered Oct 17 '22 07:10

Aron_A


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.

like image 26
Scott Newson Avatar answered Oct 17 '22 09:10

Scott Newson