Android lint on command-line missing issue groups (versus options available in Android Studio)

社会主义新天地 提交于 2019-12-01 09:03:01

问题


When I run lint in Android Studio via Analyze -> Inspect Code I am able to select from a large variety of things to look for.

When I go to the command-line version of lint and list all available things to check (lint --list), I get a list that does not include all the inspections I see in Android Studio.

For example, I am able to run an inspection with ID ConstantConditions in Android Studio, but am unable to run it on the command-line.

~/app [master] lint --check ConstantConditions --xml results.xml app
  Invalid id or category "ConstantConditions".

Is Android Studio using some other version of lint? Here is some info on the command-line version of lint:

~/app [master] which lint
  lint is /Users/Mark/android-sdk-macosx/tools/lint
~/app [master] lint --version
  lint: version 24.3.3

回答1:


IntelliJ IDEA has a concept of "inspections", and Android Studio inherits this. For any given problem reported by Android Studio's inspection engine, there can be three theoretical sources:

  1. A stock IDEA inspection, one that Android Studio simply adopted.

  2. An Android Studio-specific inspection, for something that perhaps can only readily be detected from within the IDE versus from external Lint tools.

  3. Something from Lint.

I have no idea if #2 is actually used by anything, but it's well within the realm of possibility.

In terms of your error, either that's something that is not Lint (e.g., an IDEA inspection) or there is a naming difference between how the inspection is represented and the command-line equivalent. Since this stuff isn't especially well-documented, it's difficult to say what's going on.

However, in general, do not assume that everything that you see Android Studio yelping about is necessarily something from Lint.



来源:https://stackoverflow.com/questions/31686335/android-lint-on-command-line-missing-issue-groups-versus-options-available-in-a

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!